akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=200010;
const ll mod=1e9+7;

int main(){  
  char n;
  cin >> n;
  if(n=='A'){ cout << 'T' << endl; return 0;}
  if(n=='T'){ cout << 'A' << endl; return 0;}
  if(n=='C'){ cout << 'G' << endl; return 0;}
  if(n=='G'){ cout << 'C' << endl; return 0;}

  
  return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main{
	public static void main(String[] args){
		solve();
	}
	public static void solve(){
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		long y = sc.nextLong();
		long count = 0;
		while(x <= y){
			count++;
			x *= 2;
		}
		System.out.println(count);
	}
}



Measured memory_bytes: 23124
import java.util.Scanner;

/**
 * ZAKIREN第5章
 *
 * @author K.Yamauchi
 *
 */
public class Main {

	/** 入力用 */
	private static Scanner scan = new Scanner(System.in);

	/** 出力用 */
	private static StringBuilder stringBuilder = new StringBuilder();

	/**
	 *
	 * @param args
	 */
	public static void main(String[] args) {

		int n = scan.nextInt(); // 要素数

		// ソート対象配列の読み込み
		int[] targetArray = new int[n];
		for (int i = 0; i < n; i++) {
			targetArray[i] = scan.nextInt();
		}

		// 読み込み終了
		scan.close();
		scan = null;

		// シェルソートを実行
		shellSort(targetArray, n);

		// 結果出力
		for (int i = 0; i < targetArray.length; i++) {
			stringBuilder.append(targetArray[i]);
			stringBuilder.append('\n');
		}		System.out.print(stringBuilder.toString());

	}

	/**
	 *
	 * @param array
	 * @param number
	 * @param g
	 * @param cnt
	 * @return
	 */
	private static int insertionSort(int[] array, int number, int g) {

		// gからn-1まで
		int cnt = 0;
		for (int i = g, j = 0; i < number; i++) {
			int temp = array[i];
			j = i - g;

			// 自分より大きいやつが見つかるまで
			while (j >= 0 && array[j] > temp) {
				array[j + g] = array[j];
				j = j - g;
				cnt++;
			}
			array[j + g] = temp;
		}
		return cnt;
	}

	/**
	 *
	 * @param array
	 * @param number
	 */
	private static void shellSort (int[] array, int number) {

		// Gの準備
		int[] G = new int[15];

		int gSize = 0;
		for (int i = 1; i <= number; i = i * 3 + 1) {
			// 3g + 1
			G[gSize++] = i;
		}

		// ソートしながら結果出力
		int cnt = 0;
		stringBuilder.append(gSize);
		stringBuilder.append('\n');
		for (int i = gSize - 1; i >= 0 ; i--) {
			stringBuilder.append(G[i]);
			if (i != 0)
				stringBuilder.append(' ');
			cnt += insertionSort(array, number, G[i]);
		}
		G = null;

		// 結果出力
		stringBuilder.append('\n');
		stringBuilder.append(cnt);
		stringBuilder.append('\n');
	}
}



Measured memory_bytes: 300048
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int a = scanner.nextInt();
        final int b = scanner.nextInt();
        final int c = scanner.nextInt();

        final boolean kawaisou =
                (a == b && b != c) ||
                        (b == c && c != a) ||
                        (c == a && a != b);

        System.out.println(kawaisou ? "Yes" : "No");
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main()
{
    ll n,k; cin >> n >>k;
    if(n == k)
        cout << 0 << '\n';
    if(n < k)
    {
        ll z = abs(n - k);
        cout << min(n,z) << '\n';
    }
    if(n > k)
    {
        ll d = n % k;
        ll D = n / k;
        if(d == 0)
            cout << 0 << '\n';
        if(d != 0)
        {
            cout << abs(d - k) << '\n';
        }



    }


}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n, a[maxn];
int X, cnt[maxn], ans;
int main() {
	cin >> n;
	for(int i = 0; i < n; i++) {
		int tmp;
		cin >> a[i];
		X = X ^ a[i];
		tmp = a[i];
		int res = 0;
		res = __builtin_ctz(a[i]);
		cnt[res]++;
	}
	
	for(int i = 30; i >= 0; i--) {
		if((X >> (i)) & 1) {
			if(cnt[i] > 0) {
				X = X ^ ((1LL << (i + 1)) - 1);
				ans++;
			}
			else 
				return cout << -1, 0;
		}
	}
	return cout << ans, 0;
}

Measured memory_bytes: 640
package main

import (
  "fmt"
)

func maxInt(a ...int) int {m := a[0]; for _, x := range a {if x > m {m = x}}; return m}
func minInt(a ...int) int {m := a[0]; for _, x := range a {if x < m {m = x}}; return m}


var cand = map[rune]bool{
  'A': true,
  'C': true,
  'G': true,
  'T': true,
}

func main() {
  var s string 
  fmt.Scan(&s)
  s += "$"

  res := 0
  cnt := 0
  for _, c := range s {
    if _, ok := cand[c]; ok {
      cnt++
    } else {
      res = maxInt(res, cnt)
      cnt = 0
    }
  }
  fmt.Println(res)
}

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

int main(){
	long long A,B,C,D,E,F;
	cin >> A >> B >> C >> D >> E >> F;
	long long sw=0,s=0;
	double mx=-1.0;
	for(long long k1=0;100*k1*A<=F;k1++){
		for(long long k2=0;100*k2*B<=F;k2++){
			for(long long k3=0;k3*C<=F;k3++){
				for(long long k4=0;k4*D<=F;k4++){
					if(k3*C+k4*D<=E*(k1*A+k2*B) && 100*(k1*A+k2*B)+k3*C+k4*D<=F){
						if(k1==0 && k2==0 && k3==0 && k4==0) continue;
						long long b=k3*C+k4*D;
						long long a=100*(k1*A+k2*B);
						if(100.0*b/(a+b+0.0)>=mx){
							sw=a+b;
							s=b;
							mx=100.0*b/(a+b+0.0);
						}
					}
				}
			}
		}
	}
	cout << sw << " " << s << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl '\n'
#define ft first
#define sd second
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<double, double> pdd;
typedef pair<long long, long long> pll;
// scanf("%d %d %d %d", &w, &b, &d, &s); %lld
// printf("%d\n", points);
// const double PI = acos(-1);

int main()
{
    #ifdef LOCAL
    freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    #else
        fastIO;
    #endif
        int h, w, k, b = 0, ans = 0;
        cin >> h >> w >> k;
        vector<string> v(h);

        for(int i = 0; i<h; i++)
            cin >> v[i];

        for(int i = 0; i<(1<<h); i++){
            for(int j = 0; j<(1<<w); j++){
                for(int n = 0; n<h; n++){
                    for(int m = 0; m<w; m++)
                        if(!(i&(1<<n) || j&(1<<m)))
                            if(v[n][m] == '#') b++;
                }
                if(b==k) ans++;
                b = 0;
            }
        }
        cout << ans << endl;
        return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <string>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int p;

int mpow(int x,int n){
    ll ans = 1;
    while(n != 0){
        if(n & 1) ans = ans*x % p;
        x = x*x % p;
        n = n >> 1;
    }
    return ans;
}

int main(void){
    int n;
    string s;
    int dp;
    ll ans = 0;
    map<ll, ll> count;
    cin >> n >> p >> s;
    vector<int> m(n + 1, 0), sum(n + 1, 0);

    if (10 % p == 0){
        rep(i ,n){
            if ((s[i] - '0') % p == 0){
                ans += (i + 1);
            }
        }
    }else{
        rep(i,n){
            int num = s[i] - '0';
            m[i] = (num % p) * mpow(10, n - i - 1);
            m[i] %= p;
        }
        count[0]++;
        for (int i = n; i > 0; i--){
            sum[i - 1] = sum[i] + m[i - 1];
            sum[i - 1] %= p;
            count[sum[i - 1]]++;
        }

        for (auto x : count){
            ans += x.second * (x.second - 1) / 2;
        }
    } 
    cout << ans << endl;
}

Measured memory_bytes: 2564
#define _USE_MATH_DEFINES 
#include <cmath>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<vector>
#include<cctype>
#define rep(i,start,n) for(int i=start;i<n;i++)
#define And &&
#define Or ||
#define Lb cout<<endl
using namespace std;

int main(void) {
	string s;
	string p;
	getline(cin, s);
	getline(cin, p);
	string x(s);
	string ring = s + x;

	rep(i, 0, ring.length() - p.length()) {
		int judge = 0;
		rep(j, 0, p.length()) {
			if (p[j] == ring[i + j]) judge++;
		}
		if (judge == p.length()) {
			cout << "Yes" << endl;
			return 0;
		}
	}
		cout << "No" << endl;
		return 0;
	
}

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

  ll N , A , B  ;
  int ans = 0 ;
  cin >> N >> A >> B ;
  vector<ll> X(N) ;
  rep(i,N) cin >> X.at(i) ;
  ll sum = 0 ;
  rep(i,N-1) sum += min( A*(X.at(i+1) - X.at(i) ) , B ) ;
  cout << sum << endl;
}

Measured memory_bytes: 1024
#include<cstdio>

int main(){
    int H,W;
    int i,j;
    while (1){
    scanf("%d %d",&H,&W);
    if (H == 0 && W == 0) break;
for ( i = 0;i < H;i++){
for ( j = 0;j < W ;j++){
    if (i != 0 && j != 0 && i != H - 1 && j != W - 1){
        printf ( ".");
        }
    else {
        printf("#");
        }
    }
    printf ("\n");
}
printf ("\n");
}
}


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

int main() {
  int n;
  cin>>n;
  long long dp[90]={1};
  dp[0]=2;
  dp[1]=1;
  for(int i=2;i<=n;i++){
    dp[i]=dp[i-1]+dp[i-2];
  }
  cout<<dp[n]<<endl;
  return 0;
}
    

Measured memory_bytes: 256
#include <iostream>
int main(){
    using namespace std;
    int a,b;
    cin >> a >> b;
    if(a>b){
        cout << "a > b" << endl;
    }else if(a<b){
        cout << "a < b" << endl;
    }else{
        cout << "a == b" << endl;
    }
    return 0;
}

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

using namespace std;

int main()
{
    int a,b;
    cin>>a>>b;
    if(b%a==0)
    {
        cout<<a+b<<endl;
    }
    else
    {
        cout<<b-a<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll x,y;cin>>x>>y;
  bool isok=false;
  for(ll t=0;t<=x;++t) {
    if(4*t+2*(x-t)==y) {
      isok=true;
      break;
    }
  }
  print(isok?"Yes":"No");
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main() {
  
  string S; cin >> S;
  int Q; cin >> Q;
  int T_1 = 0;
  stack<char> start;
  queue<char> bottom;
  
  for(int i=0; i<Q; i++){
    int T; cin >> T;
    if(T == 1) T_1++;
    if(T == 2) {
      int F; cin >> F;
      char C; cin >> C;
      if(F == 1 && T_1 % 2 == 0) start.push(C);
      if(F == 1 && T_1 % 2 == 1) bottom.push(C);
      if(F == 2 && T_1 % 2 == 0) bottom.push(C);
      if(F == 2 && T_1 % 2 == 1) start.push(C);
    }
  }
  
  vector<char> ans;
  while(!start.empty()) {
    ans.push_back(start.top());
    start.pop();
  }
  for(int i=0; i<S.size(); i++) ans.push_back(S.at(i));
  while(!bottom.empty()) {
    ans.push_back(bottom.front());
    bottom.pop();
  }
  
  if(T_1 % 2 == 1) reverse(ans.begin(), ans.end());
  
  for(int i=0; i<ans.size(); i++) cout << ans.at(i);
  cout << endl;
  
}

Measured memory_bytes: 1396
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

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

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#define rep(i,n) for(int i=0;, i < n; i++)
#define rep_2(i,n) for(int i=n, i > 0; i--)
using namespace std;
using ln = long long;

int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    if((a==b && a==c && b==c)||(a!=b && a!=c && b!=c))
    {
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }

    return 0;

}

Measured memory_bytes: 3604
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
const int maxn = 1e3+7;
const int maxnn = maxn * maxn / 2;
int a[maxn];
ll pre[maxn];
ll sub[maxnn], cnt;
int n, k;
int main() {
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
        pre[i] = pre[i-1] + a[i];
        for (int j = 0; j < i; j++) {
            sub[cnt++] = pre[i] - pre[j];
        }
    }
    ll ans = 0;
    for (ll i = 1ll << 40; i; i>>=1) {
        int tot = 0;
        ans += i;
        for (int j = 0; j < cnt; j++) {
            if ((ans & sub[j]) == ans)
                tot++;
        }
        if (tot < k) {
            ans -= i;
        }
    }
    printf("%lld\n", ans);
    return 0;
}

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

int main(void){
    
    char s[101],t[101];
    int count;
    scanf("%s %s",s,t);
    
    for(int i=0; i<strlen(t) && count!=strlen(t); i++){
        if(s[0]==t[i]){
            count=0;
            for(int j=0; j<strlen(t); j++){
                if(s[j]==t[(i+j)%strlen(t)]){
                    count++;
                }
            }
        }
    }
    if(count==strlen(t))
        printf("Yes");
    else
        printf("No");
}


Measured memory_bytes: 128
import java.io.*;
import java.util.*;
class Main{
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int a = saori.saori_hayami();
		int b = saori.saori_hayami();
		String s = Integer.toString(a) + Integer.toString(b);
		int num = Integer.parseInt(s);
		boolean flg = false;
		for(int i = 1;i <= 316;i++){
			if(i*i == num){
				flg = true;
				break;
			} else if(i*i > num) {
				break;
			}
		}
		if(flg){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21076
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,pas=999999999,l;
string s;
int p[300009],q[300009];
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a>>s;
  if(s[0]=='E') p[0]=1;
	for(b=1; b<a; b++){
		if(s[b]=='E') p[b]=p[b-1]+1; else p[b]=p[b-1];
	}
	for(b=a-1; b>=0; b--){
		if(s[b]=='E') q[b]=q[b+1]+1; else q[b]=q[b+1];
	}
	for(b=0; b<a; b++){
		l=0;
		if(b>0){
			l=l+(b-p[b-1]);
		}
		if(b<a-1){
			l=l+q[b+1];
		}
		if(pas>l) pas=l;
	}
  cout<<pas;
	return 0;
}

Measured memory_bytes: 2964
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> P;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<62;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto& itr:mp)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<ll,ll,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    int n;cin>>n;
    ll cnt[n+1];
    fill(cnt,cnt+n+1,0);
    ll a[n];
    ll ans=0;
    rep(i,0,n){
        cin>>a[i];
        if(i-a[i]>=0){
            ans+=cnt[i-a[i]];
        }
        if(a[i]+i<=n)cnt[a[i]+i]++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 6768
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string str;
    cin >> str;
    ll n = str.size();

    for(int i = 0; i < n; i++){
        for(int j = 0; j < n-i; j++){
            string tmp = str.substr(0,i) + str.substr(i+j,n-i-j);
            if(tmp == "keyence"){
                cout << "YES" << endl;
                return 0;
            }
        }
    }

    cout << "NO" << endl;
    
    return 0;
}

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

#define REP(i, N) for(int i = 0; i < (int)(N); i++)
bool dp[32][1 << 12];

int main() {
	for(int N, M; cin >> N >> M, (N || M); ) {
		string str;
		string word[12];
		REP(i, N) cin >> word[i];
		REP(i, M) {
			string s;
			cin >> s;
			str += s;
		}
		int len = str.size();

		memset(dp, 0, sizeof(dp));
		REP(j, 32) dp[j][0] = true;
		
		int mask = (1 << N) - 1;
		int sum = 0;
		REP(pos, len + 1) {
			int j = pos & 31;
			REP(i, N) if( word[i] == str.substr(pos, word[i].size()) ) {
				int am = (pos + word[i].size()) & 31;
				int a = mask - (1 << i);
				dp[am][1 << i] |= dp[j][0];
				for(int state = a; state != 0; state = (state-1)&a){
					dp[am][state | (1 << i)] |= dp[j][state];
				}
			}
			sum += dp[j][mask];
			for(int state = 1; state < 1 << N; state++)
				dp[j][state] = 0; 
		}
		cout << sum << endl;
	}
}

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

#define vi vector<int>
#define pb push_back
#define ii pair<int, int>
#define x first
#define y second
#define int long long

const int MOD = 1000000007;
int frac[1000005];

int power(int x, int y) {
	if (y == 0) return 1;
	int temp = power(x, y / 2);
	temp = temp * temp % MOD;
	if (y % 2) temp = temp * x % MOD;
	return temp;
}

int inv(int x) {
	return power(x, MOD - 2);
}

int C(int x, int y) {
	return frac[y] * inv(frac[x] * frac[y - x] % MOD) % MOD;
}

main() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int x, y;
	cin >> x >> y;
	frac[0] = 1;
	for (int i = 1; i <= max(x, y); i++) {
		frac[i] = frac[i - 1] * i % MOD;
	}
	if ((x + y) % 3 != 0) return cout << 0, 0;
	int a = x - (x + y) / 3;
	int b = y - (x + y) / 3;
	if (a < 0 || b < 0) return cout << 0, 0;
	cout << C(a, a + b); 
	return 0;
}

Measured memory_bytes: 8064
#include<iostream>
#include<algorithm>
#include<cstring>
#include<numeric>
#include<vector>
using namespace std;

#define int long long

#ifdef lioraju
	#define ndbg(x) 
#else
	#define ndbg(x) x
#endif

const int mxsz = 1e5 + 5;

int v[mxsz];

int dp[mxsz];
bool vis[mxsz];

int d(int n)
{
	if (!n) return 0;
	if (vis[n]) return dp[n];
	
	vis[n] = 1;
	int mnn = 2e9;
	for (int i=n-1;i>=n-2 && i>=0; i--)
		mnn = min(mnn, d(i)+abs(v[i]-v[n]));
	
	return dp[n] = mnn;
}

signed main()
{
	ndbg( ios::sync_with_stdio(0); cin.tie(0); );
	int n; cin>>n;
	for (int i=0;i<n;i++)
		cin>>v[i];
	
	cout<<d(n-1)<<'\n';
}

Measured memory_bytes: 6656
# -*- coding: utf-8 -*-

import sys
import copy
import math

sys.setrecursionlimit(1000000)

# input = sys.stdin.readline

# ~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~

N = int(input())
A = [int(x) for x in input().split()]

s_sum = sum(A)

ans = [None] * N

ans[0] = s_sum
for i in range(1, N, 2):
    ans[0] -= 2 * A[i]

for i in range(N-1):
    ans[i + 1] = 2 * A[i] - ans[i]

print(*ans)

Measured memory_bytes: 14664
#include <bits/stdc++.h>
using longlong=long long;

int main(){
    std::cin.tie(nullptr);std::cin.sync_with_stdio(false);
    int n;std::cin>>n;
    int i=0;
    while(i*i<=n)i++;
    i--;
    std::cout<<i*i<<std::endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
using namespace std;
string s1,s2;
int main(){
    getline(cin,s1);getline(cin,s2);
    cout<<s1[0];
    for(int i=0;i<s1.size()+s2.size()-1;i++)
        if(i%2)cout<<s1[i/2+1];
        else cout<<s2[i/2];
    return 0;
}

Measured memory_bytes: 256
import string

N = int(input())


def solve(n):
    if n == 1:
        return [[0]]
    result = []
    for v in solve(n - 1):
        x = max(v)
        for i in range(x + 2):
            result.append(list(v) + [i])
    return result


def print_strig(result):
    for r in result:
        print("".join(list(map(lambda v: string.ascii_lowercase[v], r))))


print_strig(solve(N))

Measured memory_bytes: 78172
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
ll int large=(ll int)1e13+7;
ll int mod=(ll int)1e9+7;



ll int mod_exp(ll int x,ll int n)
{
    ll int result=1;
    while(n>0)
    {
        if(n%2==1)
            result=(result*x)%mod;
        x=(x*x)%mod;
        n=n/2;
    }
    return result;
}

ll int mod_inverse(ll int a)
{
    return mod_exp(a,mod-2);
}




int main()
{
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
ll int T,i,j,ij;
T=1;
 //cin>>T;
while(T--)
{
   ll int a[5];
   rep(i,0,5)
   cin>>a[i];
   rep(i,0,5)
   if(a[i]==0)
   {
       cout<<i+1<<endl;
   }



}
return 0;
}













Measured memory_bytes: 3636
N,M = map(int,input().split())
AC = [False]*N
WA = [0]*N
for m in range(M):
    p,s = map(str,input().split())
    p = int(p)
    if AC[p-1] == False and s == 'WA':
        WA[p-1] += 1
    elif AC[p-1] == False and s == 'AC':
        AC[p-1] = True
indexes = [i for i, x in enumerate(AC) if x == False]
for i in indexes:
    WA[i] = 0
print(AC.count(True),sum(WA))

Measured memory_bytes: 8600
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define PB push_back
#define PPB pop_back
#define MP make_pair
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define test(x) cout<<(x)<<" "
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define loop(i,start,end) for(ll i=start; i<end; i++)
#define rloop(j,start,end) for(ll j=start-1; j>=end; j--)

int main()
{   
    IOS;

    ll n;
    cin>>n;

    ll a[n],dp[n+1]={0};
    loop(i,0,n)
        cin>>a[i];

    if(n==2)
    {   
        d1(abs(a[1]-a[0]));
        return 0;
    }

    dp[n-1]=0;
    dp[n-2]=abs(a[n-1]-a[n-2]);
    rloop(i,n-2,0)
        dp[i]=min(dp[i+1]+abs(a[i]-a[i+1]),dp[i+2]+abs(a[i]-a[i+2]));
    
    d1(dp[0]);
}

Measured memory_bytes: 1792
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

N = I()

dig = len(str(N))
if dig==1:
  print(N)
  exit()
if dig==2:
  print(9)
  exit()
if dig==3:
  print(9+N-100+1)
  exit()
if dig==4:
  print(9+900)
  exit()
if dig==5:
  print(9+900+N-10000+1)
  exit()
if dig==6:
  print(9+900+90000)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
const int Inf = 1e9 + 5;
 
int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    int sz = a[n - 1];
    vector<bool> dp(sz + 1);
    vector<int> cnt(sz + 1);
    for (int i = 0; i < n; i++) {
        cnt[a[i]]++;
        for (int j = a[i] + a[i]; j <= sz; j += a[i]) {
            dp[j] = 1;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (cnt[a[i]] == 1 && !dp[a[i]]) ans++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 7900
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main(){
    string S;
    bool flag = true;
    int cnt = 0;
    cin >> S;

    if(S[0] != 'A')flag = false;
    for(int i = 1; i < S.size(); i++){
        if(S[i] == 'C')continue;
        if(S[i] < 'a' || S[i] > 'z' ){
            flag = false;
        }
    }
    for(int i = 2; i < S.size()-1; i++){
        if(S[i] == 'C')cnt++;
    }
    // cout << cnt;
    if(cnt == 1 && flag){
        cout << "AC" << endl;
    }else{
        cout << "WA" << endl;
    }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
    int h,w;
    cin >> h >> w;
    while(h != 0 || w != 0) {
        for(int i = 0;i < h;i++) {
            for(int j = 0;j < w;j++) {
                char c = '#';
                if((j+i)%2)
                    c = '.';
                cout << c;
            }
            cout << endl;
        }
        cout << endl;
        cin >> h >> w;
    }
    return 0;
}


Measured memory_bytes: 3092
import Control.Applicative
import Control.Monad
import Data.List
sentaku :: Ord a => [a] -> Maybe (a, [a])
sentaku [] = Nothing
sentaku xs = Just (y, ys)
  where
    y  = maximum xs
    ys = delete y xs

sentakuSort :: Ord a => [a] -> [a]
sentakuSort xs = unfoldr sentaku xs

main = do
  xs <- map read . words <$> getLine
  putStrLn $ unwords . map show . sentakuSort $ (xs :: [Int])


Measured memory_bytes: 3680
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n - 1); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
using namespace std;
using P = pair<int, int>;
typedef long long ll;

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int x, y, z, k;
  cin >> x >> y >> z >> k;
  vector<ll> a(x), b(y), c(z), d,ans;
  rep(i, x) cin >> a[i];
  rep(i, y) cin >> b[i];
  rep(i, z) cin >> c[i];
  sort(ALL(c),greater<ll>());
  rep(i, x) {
    rep(j, y) {
      d.emplace_back(a[i] + b[j]);
    }
  }
  sort(ALL(d),greater<ll>());
  rep(i, min(k, x * y)) {
    rep(j, min(z, k)) {
      ans.emplace_back(d[i] + c[j]);
    }
  }
  sort(ALL(ans), greater<ll>());
  rep(i, k) {
    printf("%lld",ans[i]);
    printf("\n");
  }
}

Measured memory_bytes: 44060
class Facts:

  def __init__(self, mod=10**9+7, n_max=1):
    self.mod     = mod
    self.n_max   = n_max
    self.fact    = [1, 1]
    self.inv     = [0, 1]
    self.factinv = [1, 1]
    if 1 < n_max:
      self.setup_table(n_max)

  def cmb(self, n, r):
    if r < 0 or n < r:
      return 0
    if self.n_max < n:
      self.setup_table(n)
    return self.fact[n] * (self.factinv[r] * self.factinv[n-r] % self.mod) % self.mod

  def factorial(self, n):
    if self.n_max < n:
      self.setup_table(n)
    return self.fact[n]
    
  def hom(self, n, k):
    return self.cmb(n+k-1, k)

  def prm(self, n, k):
    if self.n_max < n:
      self.setup_table(n)
    return self.fact[n] * self.factinv[n-k] % self.mod

  def setup_table(self, t):
    for i in range(self.n_max+1,t+1):
      self.fact.append( self.fact[-1] * i % self.mod )
      self.inv.append( -self.inv[mod % i] * (self.mod // i) % self.mod )
      self.factinv.append( self.factinv[-1] * self.inv[-1] % self.mod )
    self.n_max = t

# ABC156 Roaming
mod = 10 ** 9 + 7

n, k = map(int, input().split())

ans = 0
f = Facts(mod)

for i in range(0, min(n-1, k)+1):
  ans += f.cmb(n,i) * f.hom(n-i,i) % mod
  if ans >= mod:
    ans -= mod 

print(ans)

# ABC167 E 2020/5/11
# mod = 998244353

# n, m, k = map(int, input().split())

# ans = 0
# f = Facts(mod)
# t = m * pow(m-1, n-1-k, mod)

# for i in range(k,-1,-1):
#   ans += f.cmb(n-1,i) * t % mod
#   t = t * (m-1) % mod

# print(ans % mod)


Measured memory_bytes: 27096
#include <stdio.h>
int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    int d=a/b;
    int r=a%b;
    double f;
    f=(double)a/(double)b;
    printf("%d %d %f\n",d,r,f);
    return 0;
}


Measured memory_bytes: 2080
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math
###############################################################################\
s=input()
x=0
for i in s:
    x+=int(i)
if x%9==0:
    print("Yes")
else:
    print("No")
    


Measured memory_bytes: 68048
#include <bits/stdc++.h>
using namespace std;
#define MAX 1000000
#define MIN -1000000

int main()
{
    int K, X;
    cin >> K >> X;

    int min;
    int max;

    // 下限
    if (X - K + 1 < MIN) {
        min = MIN;
    } else {
        min = X - K + 1;
    }

    // 上限
    if (X + K - 1 > MAX) {
        max = MAX;
    } else {
        max = X + K - 1;
    }

    for (int i = min; i <= max; i++) {
        cout << i << " ";
    }
    cout << endl;
}


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

typedef long long lint;
typedef pair<int, int> ii;

const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int n, h, w, a[105][105];

int solve(){
	cin >> h >> w >> n;
	int now = 0;
	for(int i=0;i<n;i++){
		int x; cin >> x;
		for(int j=0;j<x;j++){
			a[now / w][now % w] = i;
			now++;
		}
	}
	for(int i=0;i<h;i+=2) reverse(a[i], a[i]+w);
	for(int i=0;i<h;i++) for(int j=0;j<w;j++) cout << a[i][j] + 1 << " \n"[j==w-1];
	return 0;
}


int main(){
	ios::sync_with_stdio(0);
	// int t; cin >> t; while(t--)
	solve();
	// cout << (solve() ? "YES" : "NO") << endl;
	return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<algorithm>
using namespace std;
int prime[31000];
int pl[5000];
int main(){
	prime[0]=prime[1]=-1;
	for(int i=2;i<31000;i++){
		if(~prime[i]){
			prime[i]=1;
			for(int j=i+i;j<31000;j+=i)prime[j]=-1;
		}
	}
	int sz=0;
	for(int i=0;i<31000;i++)if(~prime[i])pl[sz++]=i;
	int a;
	while(scanf("%d",&a),a){
		int ret=0;
		for(int i=0;i<sz;i++){
			for(int j=i;j<sz;j++){
				int rem=a-pl[i]-pl[j];
				if(rem>=pl[i]+pl[j]||rem<pl[j])continue;
				if(~prime[rem]){
				//	printf("%d %d %d\n",pl[i],pl[j],rem);
					ret++;
				}
			}
		}
		printf("%d\n",ret);
	}
}

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

int main(void){
  string a,b,c;
  cin>>a>>b>>c;
  
  if(a[a.size()-1]==b[0] && b[b.size()-1]==c[0])cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}

Measured memory_bytes: 3608
N = int(input())
S = input()
count = S.count("R") * S.count("G") * S.count("B")


for j in range(N):
    for i in range(j):
        k = 2 * j - i
        if k >= N:
            continue
        if (S[i] != S[j]) and (S[i] != S[k]) and (S[j] != S[k]):
            count -= 1
print(count)

Measured memory_bytes: 9156
fun main() {
    var (x, y) = readLine()!!.split(" ").map{it.toInt()}

    for(i in 0 until x + 1) {
        var j = x - i
        if(i * 2 + 4 * j == y) {
            println("Yes")
            return
        }
    }
    println("No")
}

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

int main(void){
    string N;
    cin>>N;
    rep(i,N.size()){
        if(N[i]=='9'){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}


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

#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()

int main() {
    int n;
    cin >> n;
    vector<int> A, L;
    PUSH(n,A);
    L.push_back(A[0]);
    FOR(i,1,n) {
        if (L.back() < A[i]) L.push_back(A[i]);
        else *lower_bound(ALL(L), A[i]) = A[i];
    }
    cout << L.size() << endl;
    return 0;
}

Measured memory_bytes: 2060
def parent(s):
    sib[ch[s][0]] = ch[s][1]
    sib[ch[s][1]] = ch[s][0]
    if ch[s][0] != -1:
        par[ch[s][0]] = s
        dep[ch[s][0]] = dep[s]+1
        parent(ch[s][0])
    if ch[s][1] != -1:
        par[ch[s][1]] = s
        dep[ch[s][1]] = dep[s]+1
        parent(ch[s][1])


def setheight(t):
    h1 = h2 = 0
    if ch[t][0] != -1:
        h1 = setheight(ch[t][0]) + 1
    if ch[t][1] != -1:
        h2 = setheight(ch[t][1]) + 1
    high[t] = (h1 if h1 > h2 else h2)
    return high[t]
n = int(input())
data = [list(map(int, input().split())) for _ in range(n)]

ch = {}
par = {}
sib = {}
dep = {}
deg = {}
high = {}
kara = []
for i in range(n):
    kara.append(i)

for i in data:
    tmp = 0
    if i[1] != -1:
        tmp += 1
    if i[2] != -1:
        tmp += 1
    deg[i[0]] = tmp
    ch[i[0]] = i[1:]
    try:
        kara.remove(i[1])
    except:
        pass
    try:
        kara.remove(i[2])
    except:
        pass
r = kara[0]
#print(r)
par[r] = -1
sib[r] = -1
dep[r] = 0
parent(r)
setheight(r)

for i in range(n):
    if par[i] == -1:
        tmp = 'root'
    elif ch[i][0] == -1 & ch[i][1] == -1:
        tmp = 'leaf'
    else:
        tmp = 'internal node'
    print('node {}: parent = {}, sibling = {}, degree = {}, depth = {}, height = {}, {}'.format(i, par[i], sib[i], deg[i], dep[i], high[i], tmp))

#print(ch)
#print(par)
#print(sib)
#print(deg)
#print(dep)
#print(high)


Measured memory_bytes: 5624
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAX 100005
#define ll long long
struct Edge{
    ll to;
    ll next;
    ll cost;
};
Edge edge[MAX*2];
ll head[MAX];
ll dis[MAX];
void DFS(ll u,ll v,ll w)
{
    dis[u]=w;
    for(ll i=head[u];i!=-1;i=edge[i].next)
    {
        ll to=edge[i].to;
        if(to==v)
            continue;
        DFS(to,u,w+edge[i].cost);
    }
    return ;
}
int main()
{
    ll n,u,v,w,q,k;
    scanf("%lld",&n);
    ll cnt=0;
    memset(head,-1,sizeof(head));
    for(ll i=1;i<=n-1;i++)
    {
        scanf("%lld%lld%lld",&u,&v,&w);
        edge[cnt].to=v;
        edge[cnt].cost=w;
        edge[cnt].next=head[u];
        head[u]=cnt++;
        edge[cnt].to=u;
        edge[cnt].cost=w;
        edge[cnt].next=head[v];
        head[v]=cnt++;
    }
    scanf("%lld%lld",&q,&k);
    DFS(k,-1,0);
    while(q--)
    {
        scanf("%lld%lld",&u,&v);
        printf("%lld\n",dis[u]+dis[v]);
    }
    return 0;
}


Measured memory_bytes: 12800
/****************************************************************************
Is this the real life? Is this just fantasy?
Caught in a landslide, no escape from reality
Open your eyes, look up to the skies and see
I'm just a poor boy, I need no sympathy
Because I'm easy come, easy go, little high, little low
Any way the wind blows doesn't really matter to me, to me!!!
--------------------------------------------------
CP is quite cool.It becomes cooler when you enjoy learning new things
******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define endl "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,a,b) for(int i=a;i<=b;i++)
#define pool(i,a,b) for(int i=a;i>=b;i--)
#define pi pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(a) a.size()
#define ff first
#define ss second
#define debug(x) cout<<#x<<" = "<<x<<endl;
const int mod=1e9+7;

ll maxAbsValExpr(vector<ll> & x, vector<ll>& y) {
  
        ll res = 0, n = x.size(), smallest, cur;
        for (int p : {1, -1}) {
            for (int q : {1, -1}) {
                smallest = p * x[0] + q * y[0];
                for (int i = 1; i < n; ++i) {
                    cur = p * x[i] + q * y[i];
                    res = max(res, cur - smallest);
                    smallest = min(smallest, cur);
                }
            }
        }
        return res;
    }

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

  cout<<maxAbsValExpr(x,y)<<endl;

} 

int main()
{

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

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

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

  return 0;
}


Measured memory_bytes: 6360
N, K = map(int, input().split())
people = [1]*N
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for j in range(d):
        if people[A[j] - 1] == 1:
            people[A[j] - 1] = 0

print(sum(people))

Measured memory_bytes: 9196
//#pragma GCC optimize "trapv"
//-D_GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define ii pair<int,int>
#define Max 100000+5
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define f first
#define s second
#define pb push_back
int mod = 1000000007;
int mod1 = 998244353;
vector<int> g[Max];
bool vis[Max];
int d, x, y;
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
void ex(int A, int B) {
    if(B == 0) {
        d = A;
        x = 1;
        y = 0;
    }
    else {
        ex(B, A%B);
        int temp = x;
        x = y;
        y = temp - (A/B)*y;
    }
}


void dfs(int u){

	vis[u]=1;
	for(int i=0;i<g[u].size();i++){
		int v=g[u][i];
		if(vis[v]!=1)
			dfs(v);
	}
}



int power(int a,int b){
    if(b==1)return a;
    if(a>mod)a%=mod;
    int r=1;
    while(b){
        if(b&1)r=r%mod*a%mod;
        a=a%mod*a%mod;
        b/=2;
    }
    return r;
}
class uf{
    vector<int> v;
    vector<int> sz;
    
    
    public :
    uf(int n){
        v.resize(n+1);
        iota(v.begin()+1,v.end(),1);
        sz.resize(n+1,1);
        //1 to sz
    }
    int root(int b){
        while(v[b]!=b){
            b = v[b];
        }   
        return b;
    }
    void u(int a, int b){
        //combine a and b
        
        int ra=root(a);
        int rb=root(b);
        if(ra==rb)return ;
        if(sz[ra]<sz[rb]){
            v[ra] = v[rb];
            sz[rb]+=sz[ra];
        }else{
            v[rb]=v[ra];
            sz[ra]+=sz[rb];
        }
    }
    bool f(int a,int b){
        //same set
        return (root(a)==root(b));
    }
   
    
};


int32_t main(){
	IO
	string s;
  cin>>s;
  if(s[0]=='7' or s[1]=='7' or s[2]=='7' )cout<<"Yes";
  else cout<<"No";
}

Measured memory_bytes: 5992
N, K = [int(_) for _ in input().split()]
D = [int(_) for _ in input().split()]

def check(x, D):
    while x > 0:
        x, k = divmod(x, 10)
        if k in D:
            return False
    return True

result = N

while 1:
    if check(result, D):
        break
    result += 1

print(result)

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

int main() {
    while(1) {
        int h, w;
        cin >> h >> w;
        if (h == 0 && w == 0) break;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define forin(in) for(int i=0; i<(int)in.size(); i++) cin>>in[i]
#define forout(out) for(int i=0; i<(int)out.size(); i++) cout<<out[i]<<endl
#define rep(i, n) for(int i=0; i<(n); i++)

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

    for(int i = -200; i <= 200; i++){
        for(int j = -200; j <= 200; j++){
            if(pow(i, 5) - pow(j, 5) == X){
                cout<< i << " " << j << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 4084
import Control.Monad
import Data.Array
import Data.Maybe
import qualified Data.ByteString.Char8 as BC


main :: IO ()
main = do
    n <- fst . fromJust . BC.readInt <$> BC.getLine
    as <- listArray (1, n) <$>
        replicateM n (fst . fromJust . BC.readInt <$> BC.getLine)
    putStrLn $ case lookup 2 (f n as 1 1) of
                Nothing -> "-1"
                Just i -> show i
    where
        f :: Int -> Array Int Int -> Int -> Int -> [(Int, Int)]
        f n as c i | c > n = []
        f n as c i = let i' = as ! i
                     in  (i', c) : f n as (c + 1) i'


Measured memory_bytes: 21884
import java.util.Scanner;

public class Main
{	
	private static long[] input = new long[100010];
	
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
	
		int i , j , n;
		long a , b , ans = 0;
		
		n = scan.nextInt();
		a = scan.nextInt();
		b = scan.nextInt();
		
		for (i = 1;i <= n;i ++)
			input[i] = scan.nextInt();
		for (i = 1;i <= n - 1;i ++)
		{
			long diff = input[i + 1] - input[i];
			long cost1 = b , cost2 = a * diff;
			ans += Math.min(cost1 , cost2);
		}
		
		System.out.println(ans);
	}
    
}










Measured memory_bytes: 48888
import scala.math._

// longでrangeの作り方

object Main extends App {

  val YES = "YES"
  val Yes = "Yes"
  val NO = "NO"
  val No = "No"
  ///////////////////////////////////////////

  val sc = new java.util.Scanner(System.in)
  val a, b, c = sc.nextInt
//  val list = List.fill(3)(sc.next)

  val ans = if (a + b == c || b + c == a || a + c == b) Yes else No

  println(ans)


  ///////////////////////////////////////////

  def bigIterator(start: BigInt, end: BigInt, step: BigInt = 1) =
    Iterator.iterate(start)(_ + step).takeWhile(_ <= end)

  def lcm(a :Int, b :Int): Int =
    a / gcd(a, b) * b

  def lcm(a :Long, b :Long): Long =
    a / gcd(a, b) * b

  def gcd(a: Int, b: Int): Int =
    if (b == 0) a else gcd(b, a % b)

  def gcd(a: Long, b: Long): Long =
    if (b == 0) a else gcd(b, a % b)

  def setOrUpdated[A, B](a: Map[A, B], key: A, value: B, f: (B, B) => B) =
    a.get(key) match {
      case Some(v) => a.updated(key, f(value, v))
      case _ => a + (key -> value)
    }
}

Measured memory_bytes: 27328
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>0;--i)
#define yesno(flg) if(flg){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define Vi vector<int>
#define Vl vector<long long>
#define pb(a) push_back(a)
using namespace std;

typedef long long ll;
const int inf=1000000000;
const int np=1000000007;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main() {
	int n,x,y,z;
	int a[101]={};
	int b[101]={};
	int c[101]={};
	int a1,b1,c1;

	cin>>n;
	cin>>x;
	rep(i,x){
		cin>>a1;
		a[a1]=1;
	}
	cin>>y;
	rep(i,y){
		cin>>b1;
		b[b1]=1;
	}
	cin>>z;
	rep(i,z){
		cin>>c1;
		c[c1]=1;
	}
	int total=0;
	for(int i=1;i<n+1;++i){
		if(c[i]>0&&(b[i]>0||a[i]==0))total++;
	}
	cout<<total<<endl;
	return 0;
}



Measured memory_bytes: 3128
cards = []
suits = ['S', 'H', 'C', 'D']

for i in range(len(suits)):
    for j in range(1, 14):
        cards.append(suits[i] + ' ' + str(j))

n = int(input())

for i in range(n):
    cards.remove(input())

for i in range(len(cards)):
    print(cards[i])

Measured memory_bytes: 7660
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>

using namespace std;

int main(void) {
    int n,a;
    cin>>n>>a;

    int b;
    b=n/500;

    int c;
    c=n-(b*500);

    if(c<=a){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256