akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.util.Map.Entry;
 
class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
   	 static List<ArrayList<Integer>> list= new ArrayList<ArrayList<Integer>>();
//	 static int mod = 998244353;
	 public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
	        int X = sc.nextInt();
	        int Y = sc.nextInt();
	        int A = sc.nextInt();
	        int B = sc.nextInt();
	        int C = sc.nextInt();
	        
	        long[] a = new long[A];
	        for (int i=0 ; i<A; i++) {
	            a[i] = Long.parseLong(sc.next());
	        }
	        long[] b = new long[B];
	        for (int i=0 ; i<B; i++) {
	            b[i] = Long.parseLong(sc.next());
	        }
	        long[] c = new long[C];
	        for (int i=0 ; i<C; i++) {
	            c[i] = Long.parseLong(sc.next());
	        }
	        Arrays.sort(a);
	        Arrays.sort(b);
	        Arrays.sort(c);
	        
	        long[] d=new long[X+Y+C];
	        for(int i=0;i<X;i++) {
	        	d[i]=a[A-1-i];
	        }
	        for(int i=0;i<Y;i++) {
	        	d[X+i]=b[B-1-i];
	        }
	        for(int i=0;i<C;i++) {
	        	d[X+Y+i]=c[i];
	        }
	        
	        Arrays.sort(d);
	        long ans=0;
	     	for(int i=0;i<X+Y;i++) {
	     		ans=ans+d[X+Y+C-i-1];
	     	}
	        
	        
	        	System.out.println(ans);
	        	        	        
	 }
}

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

int main() {
	string s;
	int B = 0;
	long long ans = 0;
	cin >> s;
	rep(i, s.size()) {
		if (s[i] == 'B') B++;
		else  ans += B;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

N = int(input())

res = 1e+9
for i in make_divisors(N):
    j = N//i
    ans = max(len(str(i)),len(str(j)))
    res = min(res,ans)

print(res)

Measured memory_bytes: 3064
/*********************
*@Author:   CKang *
*@Language: C++11    *
*********************/
#include<bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
//#define DEBUG
#define RI register int
#define endl "\n"

using namespace std;

typedef long long ll;
//typedef __int128 lll;
//const int N=100000+10;
const int M=100000+10;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-9;
const int INF = 0x3fffffff;
const ll LINF = 0x3fffffffffffffff;

inline ll read(){
    long long x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}

int main()
{
#ifdef DEBUG
    freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout)
#endif
    //cout.tie(0);
    //ll t = read() ;
    //while(t--){}
    ll n=read();
    while(n){
        if(n%10==7){
            puts("Yes");
            return 0;
        }
        n/=10;
    }
    puts("No");
#ifdef DEBUG
    printf("Time cost : %lf s\n",(double)clock()/CLOCKS_PER_SEC);
#endif
    //cout << "Fuck You !" << endl;
    return 0;
}


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

int N, S, ptst, ptend, currsum;

int main() {
    cin >> N >> S;
    int ans = N + 1;
    int a[N];
    for (int i=0; i<N; i++) cin >> a[i];
    currsum = a[0];
    while (ptend < N) {
        if (currsum >= S) {
            ans = min(ans, ptend - ptst + 1);
            currsum -= a[ptst];
            ptst++;
        } else {
            ptend++;
            currsum += a[ptend];
        }
    }
    if (ans == N+1) ans = 0;
    cout << ans << endl;
}


Measured memory_bytes: 3484
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
int main() {
   int a,b,c;
   cin>>a>>b>>c;
   rep(i,c){
      if(b>=a+i){
         cout<<a+i<<endl;
      }
   }
      rep(i,c){
         if(a+c-1<b-c+i+1)
            cout<<b-c+i+1<<endl;
      }
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(a) cerr << #a << ": " << a << endl
#define sz(a) int(a.size())
#define rep(i,n) for(int i=0;i<n;i++)
#define forr(i, st, en) for(int i = st; i <= en; i++)
#define all(v) (v).begin(),(v).end()
#define X first
#define Y second
#define fast cin.tie(0); ios::sync_with_stdio(false)
#define vi vector<int>
#define vii vector<vector<int>>

int32_t main(){ fast;
	//a + b == 3;
	//2a + 4b == 8
	
	int x, y; cin>>x>>y;
	for(int a = 0; a <= 100; ++a)
		for(int b = 0; b<= 100; b++)
			if(a + b == x && 2 * a + 4 * b == y){
				cout<<"Yes\n";
				return 0;
			}
	cout<<"No\n";
}


Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<limits.h>
#include<string.h>
using namespace std;
#define INF LLONG_MAX
#define inf INT_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
typedef pair<int, int> P;
ll GCD(ll a, ll b) {
	if (b == 0)return a;
	return GCD(b, a%b);
}
ll LCM(ll a, ll b) {
	return a / GCD(a, b)*b;
}
ll mypow(ll a, ll b) {
	if (b == 0)return 1;
	if (b % 2)return mypow(a, b - 1)*a;
	else return mypow(a, b / 2)*mypow(a, b / 2) ;
}
/*
//Conbination!
ll c[51][51];
void comb(int n) {
	rep(i, 51) {
		rep(j, i + 1) {
			if (j == 0 || j == i)c[i][j] = 1;
			else c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
		}
	}
}
*/
int n, a[110], b[110], c[110], d[110];
vector<int> vec[210];
int match[210];
bool used[210];
void add_edge(int u, int v) {
	vec[u].push_back(v);
	vec[v].push_back(u);
}
bool dfs(int v) {
	used[v] = true;
	for (int i = 0; i < vec[v].size(); i++) {
		int u = vec[v][i];
		int w = match[u];
		if (w < 0 || !used[w] && dfs(w)) {
			match[v] = u;
			match[u] = v;
			return true;
		}
	}
	return false;
}
int bipartite_batching() {
	int res = 0;
	memset(match, -1, sizeof(match));
	for (int v = 0; v < 2 * n; v++) {
		if (match[v] < 0) {
			memset(used, 0, sizeof(used));
			if (dfs(v))res++;
		}
	}
	return res;
}
int main() {
	cin >> n;
	rep(i, n)cin >> a[i] >> b[i];
	rep(i, n)cin >> c[i] >> d[i];
	rep(i, n) {
		rep(j, n) {
			if (a[i] < c[j] && b[i] < d[j])add_edge(i, j + n);
		}
	}
	cout << bipartite_batching() << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner

import scala.collection.mutable.ArrayBuffer

object Main {

  case class Range(begin: Int, end: Int)

  def read() = {
    val sc = new Scanner(System.in)
    val h, w, k = sc.nextInt()
    val cho = IndexedSeq.fill(h)(sc.next().map(c => if (c == '0') 0 else 1))
    (h, w, k, cho)
  }

  def solve(h: Int, w: Int, k: Int, cho: IndexedSeq[IndexedSeq[Int]]): Int = {
    // h=1がこわい
    // 2次元累積和
    def addVec(a: IndexedSeq[Int], b: IndexedSeq[Int]): IndexedSeq[Int] = {
      (a, b).zipped.map(_ + _)
    }

    val chocum = cho.map(_.scanLeft(0)(_ + _)).scanLeft(IndexedSeq.fill(w + 1)(0))(addVec)

    //左上含める右下含めない
    def sumwch(x1: Int, y1: Int, x2: Int, y2: Int): Int =
      chocum(y2)(x2) - chocum(y1)(x2) - chocum(y2)(x1) + chocum(y1)(x1)

    // 横切りを指定して最小縦切り数を求める
    def calcBest(cutsHol: IndexedSeq[Boolean]): Int = {
      val parHol = ArrayBuffer.empty[Range]
      var tmp = 0
      for (i <- cutsHol.indices) {
        if (cutsHol(i)) {
          parHol.append(Range(tmp, i + 1))
          tmp = i + 1
        }
      }
      parHol.append(Range(tmp, h))

      // x-1とxの間を切る
      var tmpx = 0
      var cnt = 0//カット回数
      for(x <- 1 until w+1){
        // [tmpx, x), range
        if(parHol.forall(rng => sumwch(tmpx, rng.begin, x, rng.end)<= k)){
          // カットしない
        }else{
          cnt += 1
          if(tmpx == x-1){
            val inf = 1000000007
            // 無理
            return inf
          }
          tmpx = x-1
        }
      }
        cnt
    }

    val result = for (pattern <- 0 until 1 << h - 1) yield {
      val patternList =
        (0 until h - 1).map(i => (pattern >> i) & 1).map(_ == 1)
      // patternList(y): yとy+1の間で切るかどうか
      val numHol = patternList.count(p => p)
      val numVer = calcBest(patternList)
      numHol + numVer
    }
    result.min
  }

  def main(args: Array[String]): Unit = {
    val (h, w, k, cho) = read()
    println(solve(h, w, k, cho))
  }
}

Measured memory_bytes: 40736
/*************************************************\
           In the name of almighty ALLAH
                 MD.Faysal Hasan
                Comilla Univesity
\*************************************************/

#include<bits/stdc++.h>
using namespace std;

#define     ikarus_101  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef     long long             ll;
typedef     long double           ld;
typedef     unsigned long long    ull;
typedef     vector<ll>            vll;
typedef     pair<ll,ll>           pll;
typedef     vector<pll>           vpl;
typedef     map<ll,ll>            mll;
typedef     multiset<ll>          msl;
typedef     multimap<ll,ll>       Mll;
using pqboro=priority_queue<ll,vll,less<ll>>;
using pqchoto=priority_queue<ll,vll,greater<ll>>;

#define    all(str)       str.begin(),str.end()
#define    sajo(str)      sort(str.begin(),str.end())
#define    rev(str)       reverse(str.begin(),str.end())
#define    usajo(str)     sort(str.rbegin(),str.rend())
#define    vin(a)         for(auto &it : a) cin>>it
#define    vout(a)        for(auto it:a) cout<<it<<' ';cout<<nn
#define    pb             push_back
#define    eb             emplace_back
#define    mkp(x,y)       make_pair(x,y)
#define    F              first
#define    S              second
#define    yes            cout<<"YES"<<nn
#define    no             cout<<"NO"<<nn
#define    nn             "\n" ///endl
#define    rep(i,n)       for (i=0;i<n;++i )
#define    rep1(i,n)      for (i=1;i<=n;++i )

#define    min3(a,b,c)    min(a,min(b,c))
#define    max3(a,b,c)    max(a,max(b,c))
#define    sqr(x)         ((x)*(x))
#define    pi             2*acos(0.0)
#define    gcd(a,b)       __gcd(a,b)
#define    lcm(a,b)       (a/gcd(a,b))*b
#define    mem(a,b)       memset(a,b,sizeof (a))
#define    dec(x)         cout<<fixed<<setprecision(x)
#define    none(n)         __builtin_popcountll(n)

template < typename T > string toString ( T Number ) { stringstream ss ; ss << Number ; return ss.str() ; }
template < typename T > ll toll ( T str ) { stringstream ss ; ss << str ; ll num ; ss >> num ; return num ; }

const   int  N   =   2e5+7;
const   int  M   =   1e9+7;
const   ll  inf  =   0x7f7f7f7f7f7f7f7f;

int main() {ikarus_101

    ll n,m,i,j,k,x;

    cin >> n;
    ll cnt = 0;
    rep1(i,n)
    {
        cin >> x;
        if(i&x&1 == 1) cnt++;
    }
    cout << cnt << nn;














}


Measured memory_bytes: 3624
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        
        int[] dificulties = new int[num];
        for(int i = 0; i < num; i++){
            dificulties[i] =  sc.nextInt();
        }
        Arrays.sort(dificulties);
        int halfNum = num / 2;
        int ans = dificulties[halfNum] - dificulties[halfNum-1];

        System.out.println(ans);
    }
}

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

#define TYPE(c)   remove_reference_t<decltype(c)>
#define REP(i, n) for(TYPE(n) i = 0; i < n; i++)
#define FOR(v, c) for(TYPE(c.begin()) v = c.begin(); v != c.end(); v++)
#define ALL(c)    c.begin(), c.end()
#define SORT(c)   sort(ALL(c))
#define RSORT(c)  sort(ALL(c), greater<TYPE(c)::value_type>())
#define UNIQUE(c) c.erase(unique(ALL(c)), c.end())

using namespace std;
using ll = long long;

constexpr int MOD  = (int)1e9 + 7;
constexpr int INF  = (int)1e9 + 1;
constexpr ll  LINF = (ll)1e18 + 1;
template<typename T> constexpr bool chmax(T& a, const T& b)
{ if(a < b) { a = b; return true; } else { return false; } }
template<typename T> constexpr bool chmin(T& a, const T& b)
{ if(b < a) { a = b; return true; } else { return false; } }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T>& p)
{ return os << "(" << p.first << "," << p.second << ")"; }
ostream& operator<<(ostream &os, const string& s)
{ FOR(v, s) os << *v; return os; }
template<typename T> auto operator<<(ostream& os, const T& t)
    -> typename conditional<true, ostream&, decltype(*t.begin())>::type
{ os << "["; FOR(v, t) { if(v != t.begin()) os << ","; os << *v; } os << "]"; return os; }

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

    int N, X;
    std::cin >> N >> X;
    std::vector<int> M(N);
    REP(i, N) {
        std::cin >> M[i];
    }

    auto ans   = M.size();
    auto min_m = *min_element(ALL(M));
    X -= accumulate(ALL(M), 0LL);
    ans += X / min_m;
    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
//	ZapZu's code hohoho
//	#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define dfs_black 1
#define dfs_white -1
#define pr pair
#define vt vector
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef double db;
typedef long long li;
typedef long double ld;

typedef pr<int, int> ii;
typedef pr<ld,ld> dd;

typedef vt<int> vi;
typedef vt<li> vli;
typedef vt<ld> vld;
typedef vt<ii> vii;

typedef map<int, int> mii;
typedef map<int, bool> mib;
typedef map<int, char> mic;

typedef set<int> s_i;
typedef set<char> s_c;

const int MOD = 1e9+7;
const li INF = 1e18;
const ld PI = 4*atan((ld)1);
int a[55][1000005];
int dp[1000005];
signed main()
{
//	freopen(".inp", "r", stdin);
//	freopen(".out", "w", stdout);
	int n;
	cin>>n;
	vi v;
	for(int i=1; i<=n; i++)
	{
		char c;
		cin>>c;
		a[1][i]=c-'0';
		dp[i]=dp[i-1];
		int temp=i;
		while(temp%2==0) temp/=2, dp[i]++;
	}
	for(int i=2; i<=min(n, 50); i++)
	{
		for(int j=1; j<=n+1-i; j++)
		{
			a[i][j]=abs(a[i-1][j]-a[i-1][j+1]);
			if(i==50) v.eb(a[i][j]);
		}
	}
	if(n<=50) cout<<a[n][1];
	else 
	{
		n=v.size()-1;
		int ans=0;
		for(int i=0; i<=n; i++)
		{
//			cout<<v[i]<<" ";
			if(dp[i]+dp[n-i]<dp[n]) continue;
			ans^=v[i];
		}
		cout<<ans;
	}
	
}




Measured memory_bytes: 206612
#include <stdio.h>
#include <stdlib.h>

struct sort_data {
    long long int C;
	long long int B;
    int index;
};

int compare1(const void *a, const void *b){
    return *(long long int*)a - *(long long int*)b;
}
int compare2(const void *a, const void *b){
    return *(long long int*)b - *(long long int*)a;
}

int main(){
    long long int N, M;
    scanf("%lld %lld", &N, &M);
    long long int A[N], i, j, k, B[M], C[M];
    for(i=0; i<N; i++){
    	scanf("%lld", &A[i]);
    }

    struct sort_data value[M];
    for (i=0; i<M; i++){
        scanf("%lld %lld", &value[i].B, &value[i].C);
        value[i].index = i;
    }

    qsort(value, M, sizeof(struct sort_data), compare2);
	qsort(A, N, sizeof(A[0]), compare1);

	int cnt=0;
	j=0;
	for (i=0; i<N; i++){
		if (A[i] < value[j].C && j<M){
			A[i] = value[j].C;
		}else{
			break;
		}
		cnt++;
		if (cnt == value[j].B){
			cnt = 0;
			j++;
		}
	}

  	long long int ans = 0;
  	for (i=0; i<N; i++){
    	ans += A[i];
    	//printf("%lld : ", A[i]);
  	}
  	printf("%lld\n", ans);

  	return 0;
}



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

int main()
{
    int q;
    int i, j, k;
    bool judge[100001] = {false};
    int count[100001] = {0};
    
    cin >> q;
    
    int l[q], r[q];
    
    for(i = 0; i < q; i++) {
        cin >> l[i] >> r[i];
    }
    
    for(j = 2; j <= 100000; j++) {
        if(judge[j] == false) {
            for(k = j*2; k <= 100000; k+=j) {
                judge[k] = true;
            }
        }
    }
    
    for(j = 3; j <= 100000; j++) {
        
        if((judge[j] == false)&&(judge[(j+1)/2] == false)) {
            count[j] = count[j-1] + 1;
        } else {
            count[j] = count[j-1];
        }
    }

    for(i = 0; i < q; i++) {
        cout << count[r[i]] - count[l[i]-1] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1920
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

struct Cat {
    Cat(const string &s, const string &t) : s(s), t(t) {}
    char operator[](size_t i) const {
        return i < t.size() ? t[i] : i == t.size() ? '\0' : s[i - t.size() - 1];
    }
    size_t size() const {
        return t.size() + 1 + s.size();
    }
    const string &s, &t;
};

template <class S>
struct MP {
    MP(const S &s) : a(s.size() + 1) {
        int j = a[0] = -1;
        for (size_t i = 0; i < s.size(); i++) {
            while (j >= 0 && s[i] != s[j]) j = a[j];
            a[i + 1] = ++j;
        }
    }
    int operator[](size_t i) const {
        return a[i];
    }
    vector<int> a;
};

struct Graph {
    struct Vertex { int n, k, d; };
    struct Edge { int i, n; };
    Graph(int n, int m) : v(n, { -1, 0, 0 }), e(m), n(n), m(0) {}
    void add_edge(int i, int j) {
        e[m] = { j, v[i].n };
        v[i].n = m;
        v[j].k++;
        m++;
    }
    void tsort() {
        vector<int> q(n);
        int i0 = 0, i1 = 0;
        for (int i = 0; i < n; i++) {
            if (v[i].k == 0) q[i1++] = i, v[i].d = 0;
        }
        while (i0 < i1) {
            int i = q[i0++];
            for (int j = v[i].n; j >= 0; j = e[j].n) {
                Edge &o = e[j];
                if (--v[o.i].k == 0) q[i1++] = o.i, v[o.i].d = v[i].d + 1;
            }
        }
        if (i1 < n) {
            cout << -1 << endl;
        } else {
            cout << v[q.back()].d << endl;
        }
    }
    vector<Vertex> v;
    vector<Edge> e;
    int n, m;
};

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

    string s, t;
    cin >> s >> t;

    int n = s.size();
    int m = t.size();
    int l = n - 1 + m;

    s.resize(l);
    for (int i = n; i < l; i++) {
        s[i] = s[i - n];
    }

    Cat u(s, t);
    MP<Cat> v(u);

    Graph g(n, n);

    int o = m + 1 + m;
    for (int i = 0; i < n; i++) {
        if (v[o + i] == m) g.add_edge(i, (i + m) % n);
    }

    g.tsort();

    return 0;
}

Measured memory_bytes: 19888
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

void solve()
{
	char c;
	cin>>c;
	if(c>='A'&&c<='Z')
	{
		ol("A");
	}
	else
	{
		ol("a");
	}
}

int main()
{ios_base::sync_with_stdio(false);
cin.tie(0);
int t=1;
while(t--)
{
	solve();
}
return 0;
}



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

int main(){
    int n;
    cin >> n;
    int t[n] = {};
    for(int i = 0; i < n; i++){
        cin >> t[i];
    }
    int m;
    cin >> m;
    int t1,t2;
    vector<int> sum(m,0);
    for(int i = 0; i < m; i++){
        cin >> t1 >> t2;
        for(int j = 0; j < n; j++){
            if(j == t1-1){
                sum[i] += t2;
            }else{
                sum[i] += t[j];
            }
        }
    }
    for(int i = 0; i < m; i++){
        cout << sum[i] << endl;
    }
}

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

using namespace std;

int main (){

  char S[3];
  cin >>S[0]>>S[1]>>S[2];

  if(S[0]=='A'&&S[1]=='A'&&S[2]=='A')
    cout <<"No";
    else if(S[0]=='B'&&S[1]=='B'&&S[2]=='B')
      cout<< "No";
      else
	cout<<"Yes";















  return 0;
}


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

using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

int32_t main()
{
	long double a, b;
	
	cin >> a >> b;
	int ans = a*b;
	cout << ans << endl;
	
	return 0;
}


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

int main() {
	int n, num = 0;
	string a, b, c;
	cin >> n >> a >> b >> c;
	for (int i = 0; i < n; i++) {
		if (a[i] == b[i] && b[i] == c[i])
			continue;
		else if (a[i] != b[i] && b[i] != c[i] && c[i] != a[i])
			num += 2;
		else
			num++;
	}
	cout << num << endl;
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()

if N % 2 == 1:
	print(0)
	sys.exit()

ans = 0
i = 1
while 1:
	if (5**i) <= N//2:
		ans += (N//2)//(5**i)
		i += 1
	else:
		break
print(ans)


Measured memory_bytes: 4200
class UnionFind:
    MAX_N = 0
    PAR  = [] 
    RANK = []

    def __init__(self,n):
        self.MAX_N = n
        self.PAR = [ i for i in range(n)]
        self.RANK= [ 0 ] * n

    def find(self,x):
        if self.PAR[x] == x:
            return x
        else:
            self.PAR[x] = self.find(self.PAR[x])
            return self.PAR[x] 

    def union(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.RANK[x] < self.RANK[y]:
            self.PAR[x] = y
        else:
            self.PAR[y] = x
            if self.RANK[x] == self.RANK[y]:
                self.RANK[x] += 1

    def same(self,x,y):
        return self.find(x) == self.find(y)

N,Q  = map(int,input().split())
Ans = []
tree = UnionFind(N+1)
for _ in range(Q):
    t,u,v = map(int,input().split())
    if t == 0:
        tree.union(u,v)
    else:
        if tree.same(u,v):
            Ans.append(1)
        else:
            Ans.append(0)
for a in Ans:
    print(a)



Measured memory_bytes: 7184
N = int(raw_input())
T = map(int,raw_input().split(" "))
M = int(raw_input())
P = []
X = []
answer = []
for m in range(M):
	input_line = map(int,raw_input().split(" "))
	P = input_line[0]
	X = input_line[1]
	answer.append(sum(T) + X - T[P-1])

txt = ""
for a in answer:
	print a


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

using namespace std;

int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    if((a * 100 + b * 10 + c) % 4){
        cout << "NO\n";
    }
    else{
        cout << "YES\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int> vec(n);
  set<int> st;
  for(int i=0;i<n;i++){
    cin>>vec[i];
    st.insert(vec[i]);
  }
  sort(vec.begin(),vec.end());
  
  int sum=0;
  for(int s:st){
    auto upb=upper_bound(vec.begin(),vec.end(),s);
    auto lowb=lower_bound(vec.begin(),vec.end(),s);
    int cnt=upb-lowb;
    if(cnt==(s)) continue;
    if(cnt-(s)<0) sum+=cnt;
    else sum+=(cnt-(s));
  }
  cout<<sum;
}
  

Measured memory_bytes: 5120
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;

int main()
{
	string str;
	while(getline(cin,str)){
		for(int rot = 0;rot< 'z' - 'a' + 1;rot++){
			string tmp = str;
			for(int i=0; i<str.size(); i++){
				if(tmp[i] == ' ') continue;
				if(tmp[i] == '.') continue;
				tmp[i] = (rot + tmp[i]-'a') % ('z' - 'a' + 1) + 'a';
			}
			//cout << tmp << endl;
			if(tmp.find("the") != string::npos
				|| tmp.find("this") != string::npos
				|| tmp.find("that") != string::npos)
			{
				cout << tmp << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
#include<vector>
#include<map>
#include <utility>
#include <math.h>
#include <queue>
# define INF 1000000000
using namespace std;
int gcd(int a, int b) {
	int d;
	if (a > b) {
		int t = b;
		b = a;
		a = t;
	}
	while ((d = b % a) != 0) {
		b = a;
		a = d;
	}
	return a;
}
int a=1;
int f;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dp[100100];
int manji[1008][1008];
char ok[1008][1008];
int H, W;
int sx, sy;

int bfs() {
	queue<pair<int, int>> que;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (manji[i][j] ==a-1) {
				que.push(pair<int, int>(i, j));
			}
		}
	}
	
	while (que.size()) {
		pair<int, int> p = que.front();
		que.pop();
		for (int i = 0; i < 4; i++) {
			int nx = p.first + dx[i], ny = p.second + dy[i];
			if (0 <= nx && nx < H && 0 <= ny && ny < W && ok[nx][ny] != '#' && manji[nx][ny] == INF) {
				que.push(pair<int, int>(nx, ny));
				ok[nx][ny] = '#';
				manji[nx][ny] = manji[p.first][p.second]+1;
				f = manji[nx][ny];
			}
		}
		
	}
	return f;
}
int main(){
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> ok[i][j];
			if (ok[i][j] == '.') {
				manji[i][j] = INF;
			}
			else { manji[i][j] = 0; }
		}
	}
	int b = bfs();
	cout << b << endl;
	return 0;
}

	



Measured memory_bytes: 13328
using System;

namespace ConsoleApplication36
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            string[] ss = s.Split(' ');
            long Max = long.Parse(ss[0]);
            long Min = long.Parse(ss[0]);
            long T = 0;
            for (int i = 0; i < n; i++)
            {
                long a = long.Parse(ss[i]);
                if (Max < a)
                {
                    Max = a;
                    T = T + a;
                }
                else if (Min > a)
                {
                    Min = a;
                    T = T + a;
                }
                else
                {
                    T = T + a;
                }
            }
            Console.WriteLine(Min + " "+ Max + " " + T);
        }
    }
}

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

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define int long long
#define all(v) v.begin() , v.end()
#define pb push_back
#define pii pair<int,int>
#define fr(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define nl '\n'
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int32_t main()
{   fastio;

    int n;
    cin>>n;
    int arr[n];
    for(int i=0; i<n; i++)
        cin>>arr[i];
    sort(arr , arr+n , greater<int>());

    int sum=0;
    int cnt=0;
    sum=arr[0];
    int p=arr[1];
    int j=1;
    for(int i=2; i<n; i++)
    {
        sum += p;
        cnt++;
        if(cnt == 2)
        {
            j++;
            cnt=0;
            p=arr[j];
        }
    }
    cout<<sum<<"\n";

}


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

int main(){
  long int n,a,b ;
  cin >> n >> a >> b ;
  if((b-a)%2==0){
    cout << (b-a)/2 << endl ;
    return 0 ;
  }
  long int ans_1 = a+(b-a-1)/2 ;
  long int ans_2 = n-b+1+(b-a-1)/2 ;
  cout << min(ans_1,ans_2) << endl ;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
const ll MOD = 1e9+7;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
#define fs first
#define sc second


const int INF = 1e9;
const ll LLINF = 1e16;

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 
template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}
 
template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}
 
template<typename T>
T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T>
T ngcd(vector<T> a){
    T res;
    res = a[0];
    for(int i = 1; i < a.size() && res != 1; i++) {
        res = gcd(a[i], res);
    }
    return res;
}
 
template<typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

template<typename T>
T nlcm(vector<T> numbers) {
    T res;
    res = numbers[0];
    for (int i = 1; i < numbers.size(); i++) {
        res = lcm(res, numbers[i]);
    }
    return res;
}


// 素数判定
template<typename T>
bool isPrime(T x){
    T i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
};

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}



// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}


using pint = pair<int, int>;
using pll = pair<ll, ll>;


int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    ll a,b,n;
    cin >> a >> b >> n;
    if(n >= b){
        print(a * (b - 1) / b);
        return 0;
    } else {
        print(a * n / b);
    }
}


Measured memory_bytes: 3640
n = int(input())
a,b = map(int, input().split())
dat = list(map(int, input().split()))
q1=q2=q3=0
for i in range(n):
    if dat[i] <= a:
        q1 += 1
    elif a < dat[i] <= b:
        q2 += 1
    else:
        q3 += 1
print(min(q1,q2,q3))


Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
inline int rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
char S[21];
int main(){
  rd(S);
  S[5] = S[13] = ' ';
  wt_L(S);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190721-1

// --- original code ---
// char S[21];
// {
//   rd(S);
//   S[5] = S[13] = ' ';
//   wt(S);
// }


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

using namespace std;

int cut(vector<int>, int);

int main(){;
    int N, M;
    vector<int> X, diff;
    cin >> N >> M;
    int data;

    if(N >= M) cout << 0 << endl;
    else{
        for(int i = 0; i < M; i++){
            cin >> data;
            X.push_back(data);
        }
        sort(X.begin(), X.end(), greater<int>());
        
        for(int i = 0; i+1 < M; i++){
            diff.push_back(X[i] - X[i+1]);
        }

        sort(diff.begin(), diff.end(), greater<int>());

        int ans = accumulate(diff.begin()+N-1, diff.end(), 0);
        cout << ans << endl;
    }    
}


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

#define int long long
#define rep(i, l, r) for (int i = (int)(l); i < (int)(r); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)x.size())
template <class T> bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

/*
 */

using vi = vector<int>;
using vvi = vector<vi>;
using P = pair<int, int>;

signed main() {
  string s, t, u;
  int a, b;
  cin >> s >> t >> a >> b >> u;

  if(s == u) a = max(0LL, a-1);
  if(t == u) b = max(0LL, b-1);

  cout << a << " " << b << endl;

  return 0;
}


Measured memory_bytes: 256
implicit none
integer :: n,i
integer(8) :: n0,n1,n2
read *,n

n0 = 2
n1 = 1
n2 = n1
do i = 2, n
   n2 = n1 + n0
   n0 = n1
   n1 = n2
enddo
write(*,'(i0)') n2
end

Measured memory_bytes: 256
import Control.Monad

main :: IO()
main = do
    a <- replicateM 3 $ map read . words <$> getLine
    n <- readLn
    b <- replicateM n readLn
    putStrLn $ if solve a b then "Yes" else "No"

solve :: [[Int]] -> [Int] -> Bool
solve a b = foldr (||) False bs
    where bs = map ts grid
          ts = toBoolRow (exist a b)

grid :: [[(Int, Int)]]
grid = [[(0, 0), (0, 1), (0, 2)], [(1, 0), (1, 1), (1, 2)], [(2, 0), (2, 1), (2, 2)]
       ,[(0, 0), (1, 0), (2, 0)], [(0, 1), (1, 1), (2, 1)], [(0, 2), (1, 2), (2, 2)]
       ,[(0, 0), (1, 1), (2, 2)], [(0, 2), (1, 1), (2, 0)]]

toBoolRow ::[[Bool]] -> [(Int, Int)] -> Bool
toBoolRow bs [] = True
toBoolRow bs ((a, b):xs) = bs !! a !! b && toBoolRow bs xs

exist :: [[Int]] -> [Int] -> [[Bool]]
exist a b = map (map (\x -> elem x b)) a

Measured memory_bytes: 508
#include <iostream>

int main() {
    long n, k;
    std::cin >> n >> k;
    long long a[n];
    for (int i = 0; i < n; ++i) {
        std::cin >> a[i];
    }

    for (int i = 0; i < n - k; ++i) {
        int j = i + k;
        if (a[i] < a[j]) {
            std::cout << "Yes" << std::endl;
        } else {
            std::cout << "No" << std::endl;
        }
    }
    return 0;
}


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

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


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func read() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	// sc.Split(bufio.ScanWords)
	// S := read()
	var a, b int
	fmt.Scan(&a)
	fmt.Scan(&b)
	ans := a + b
	if ans < a-b {
		ans = a - b
	}
	if ans < a*b {
		ans = a * b
	}
	fmt.Printf("%v\n", ans)
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
ll G[2],A[2],B[2];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,2) cin>>G[i]>>A[i]>>B[i];
	
	if(G[0]>=G[1] && A[0]>=A[1] && B[0]>=B[1]) {
		swap(G[0],G[1]);
		swap(A[0],A[1]);
		swap(B[0],B[1]);
	}
	
	ll ret=N;
	if(G[0]<=G[1]&&A[0]<=A[1]&&B[0]<=B[1]) {
		for(x=0;x<=N;x+=G[0]) {
			for(y=0;x+y<=N;y+=A[0]) {
				int z=(N-x-y)/B[0]*B[0];
				ll cur=(N-x-y-z)+x/G[0]*G[1]+y/A[0]*A[1]+z/B[0]*B[1];
				ret=max(ret,cur);
			}
		}
	}
	else {
		if(G[0]>=G[1]&&A[0]<A[1]) swap(G[0],A[0]),swap(G[1],A[1]);
		if(A[0]>=A[1]&&B[0]<B[1]) swap(B[0],A[0]),swap(B[1],A[1]);
		if(G[0]>=G[1]&&A[0]<A[1]) swap(G[0],A[0]),swap(G[1],A[1]);
		
		
		if(A[0]<A[1]) {
			for(x=0;x<=N;x+=G[0]) {
				for(y=0;x+y<=N;y+=A[0]) {
					ll cur=(N-x-y)+x/G[0]*G[1]+y/A[0]*A[1];
					ll v=cur/B[1];
					cur=cur%B[1]+v*B[0];
					ret=max(ret,cur);
				}
			}
		}
		else {
			ll v=N/G[0];
			ll cur=N%G[0]+v*G[1];
			for(x=0;x<=cur;x+=A[1]) {
				y=(cur-x)/B[1]*B[1];
				ll ncur=(cur-x-y)+x/A[1]*A[0]+y/B[1]*B[0];
				ret=max(ret,ncur);
			}
		}
	}
	cout<<ret<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
# 入力
A, B, C, D = map(int, input().split())

# 出力
if 1 <= A and B and C and D <= 10:
    if A + B == C + D:
        print('Balanced')
    elif A + B > C + D:
        print('Left')
    elif A + B < C + D:
        print('Right')
        

Measured memory_bytes: 9164
#include<bits/stdc++.h> //ABC 101_a
using namespace std;
int main(){
	char S[5],A='+',B='-';
	int ans;
	for(int i=1;i<=4;i++){
		cin>>S[i];
		if(S[i]==A)
			ans++;
		else if(S[i]==B)
			ans--;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    ll n, k;
    cin >> n >> k;
    vector<bool> flg(n, false);
    if ( k == 0 ) {
        cout << n * n << endl;
        return 0;
    }
    ll ans = 0;
    for ( ll b = k + 1; b <= n ; b++ ) {
        ll tmp_a = k;
        while(1) {
            if ( tmp_a > n ) break;
            if ( tmp_a + ( b - k - 1) > n ) {
                ans += n - tmp_a + 1;
            }
            else {
                ans += b - k;
            }  
            tmp_a += b;
        }
//        cout << b << " " << ans << endl;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;
int mod = 1e9+7;

// (Ai , Bi) -> (Aj , Bj) && Ai*Aj+Bi*Bj = 0 
// Ai*Aj = - Bi * Bj
// Ai/Bi = - Bj / Aj
// ? x/0   
// gcd(Ai,Bi) = gi 
// Ai` = Ai/gi , Bi` = Bi/gi
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}



void test_case(){
	int n; cin >> n;
	//~ vector<pair<int,int>> hash;
	int zero = 0;
	map<pair<ll,ll>,pair<int,int>> mp;
	while(n--){
		ll a , b;
		cin >> a >> b;
		if(a==0 && b==0){
			zero++;
			continue;
		}
		ll g = __gcd(a,b);
		a /= g;
		b /=g;
		if( b < 0){
			a = -a;
			b = -b;
		}
		if(b == 0 && a < 0){
			a = -a;
			b = -b;
		}
		bool rot90 = (a <= 0);
		if(rot90){
			ll tmp = a;
			a = b ; b = -tmp;
		}
		if(rot90)
			mp[{a,b}].first++;
		else
			mp[{a,b}].second++;
	}
	mint ans = 1;
	for(auto p : mp){
		int s = p.second.first;
		int t = p.second.second;
		mint now = 1;
		now += mint(2).pow(s) - 1;
		now += mint(2).pow(t) - 1;
		ans *= now;
	}
	ans -= 1;
	ans+=zero;
	cout<<ans<<"\n";     
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
	return 0;
}


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

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

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

ll mod_pow(ll x, ll n){ //べき乗
    ll ans=1;
    x%=MOD;
    while(n!=0){
        if(n&1) ans=ans*x%MOD;
        x=x*x%MOD;
        n=n>>1;
    }
    return ans%MOD;
}

int main(){
    ll N; cin >> N;
    ll ans=mod_pow(10,N)+2*MOD-2*mod_pow(9,N)+mod_pow(8,N);
    ans%=MOD;
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

#define rep(i, n) for(int i=0; i<(n); ++i)
#define max  100000

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int h[2], m[2], k;
    int m1, m2;
    
    scanf("%d%d%d%d%d", &h[0], &m[0], &h[1], &m[1], &k);
    
    m1=h[0]*60+m[0];
    m2=h[1]*60+m[1];
    
    m2=m2-m1;
    
    printf("%d", m2-k);

    return 0;
}



Measured memory_bytes: 1736
x = int(input())
if 400 <= x < 600:
    print(8)
elif 600 <= x < 800:
    print(7)
elif 800 <= x < 1000:
    print(6)
elif 1000 <= x < 1200:
    print(5)
elif 1200 <= x < 1400:
    print(4)
elif 1400 <= x < 1600:
    print(3)
elif 1600 <= x < 1800:
    print(2)
elif 1800 <= x < 2000:
    print(1)


Measured memory_bytes: 9176
n,r = gets.split.map(&:to_i)
while n !=0 && r != 0
	res = []
	n.downto(1) do |i|
		res.push(i)
	end
	0.upto(r-1) do |i|
		p,c = gets.split.map(&:to_i)
		tmp = []
		(p-1).upto(p+c-2) do |i|
			tmp.push(res[i])
		end
		0.upto(n-1) do |i|
			next if p-1 <= i && i < p + c -1 
			tmp.push(res[i])
		end
		res = tmp
	end
	n,r = gets.split.map(&:to_i)
	puts res[0]
end


Measured memory_bytes: 7376
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

N=II()
N%=10

if N == 2 or N == 4 or N == 5 or N == 7 or N == 9:
    print("hon")
elif N == 0 or N == 1 or N == 6 or N == 8:
    print("pon")
else:
    print("bon")


Measured memory_bytes: 9220
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int mod = 1000000007;
struct mint{
	ll x;
	mint(ll x = 0):x((x%mod+mod)%mod){}
	mint operator-() const{return mint(-x);}
	mint& operator+=(const mint a){
		if((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a){
		if((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a){
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const{
		mint res(*this);
		return res+=a;
	}
	mint operator-(const mint a) const{
		mint res(*this);
		return res-=a;
	}
	mint operator*(const mint a) const{
		mint res(*this);
		return res*=a;
	}
	mint pow(ll t) const{
		if(!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if(t&1) a *= *this;
		return a;
	}
	mint inv() const{
		return pow(mod-2);
	}
	mint& operator/=(const mint a){
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const{
		mint res(*this);
		return res/=a;
	}
	bool operator==(const mint a){
		return x == a.x;
	}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int H, W, K;
	cin >> H >> W >> K;
	vector<vector<mint>> dp(H+1, vector<mint>(W, 0));
	dp[0][0] = 1;
	rep(i,H){
		rep(j,W){
			rep(k,(1<<(W-1))){
				bool ok = true;
				rep(l,W-2){
					if(((k>>l) & 1) && ((k>>(l+1)) & 1)) ok = false;
				}
				if(ok){
					if(j >= 1 && ((k>>(j-1)) & 1)){
						dp[i+1][j-1] += dp[i][j];
					}
					else if(j <= W-2 && ((k >> j) & 1)){
						dp[i+1][j+1] += dp[i][j];
					}
					else{
						dp[i+1][j] += dp[i][j];
					}
				}
			}
		}
	}
	cout << dp[H][K-1].x << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int result = 3;

		if (a == b) {
			result--;
		}
		if (a == c) {
			result--;
		}
		if (b == c) {
			result--;
		}

		if (result == 0) {
			result = 1;
		}

		System.out.println(result);
	}

}


Measured memory_bytes: 35820
import java.util.Scanner;

public class Main {

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

		long a = sc.nextLong();
		long b = sc.nextLong();
		long x = sc.nextLong();
		long ans = 0;

		if (a == 0) {
			ans = b/x+1;
		} else if (a%x == 0){
			ans = (b/x)-(a/x)+1;
		} else if (a%x != 0) {
			ans = (b/x)-(a/x);
		}
		System.out.println( ans );
	}
}

Measured memory_bytes: 23764