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

using ll=int64_t;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#ifdef MAROON_LOCAL
#define cerr (cerr<<"-- line "<<__LINE__<<" -- ")
#else
class CerrDummy{}cerrDummy;
template<class T>
CerrDummy& operator<<(CerrDummy&cd,const T&){
	return cd;
}
using charTDummy=char;
using traitsDummy=char_traits<charTDummy>;
CerrDummy& operator<<(CerrDummy&cd,basic_ostream<charTDummy,traitsDummy>&(basic_ostream<charTDummy,traitsDummy>&)){
	return cd;
}
#define cerr cerrDummy
#endif
#define REACH cerr<<"reached"<<endl
#define DMP(x) cerr<<#x<<":"<<x<<endl
#define ZERO(x) memset(x,0,sizeof(x))
#define ONE(x) memset(x,-1,sizeof(x))

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"{";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

ll read(){
	ll i;
	scanf("%" SCNd64,&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(ll x,int suc=1){
	printf("%" PRId64,x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341000];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341000];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(b<a)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

//#define CAPITAL
void Yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<endl;
	#else
	cout<<"Yes"<<endl;
	#endif
	if(ex)exit(0);
}
void No(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<endl;
	#else
	cout<<"No"<<endl;
	#endif
	if(ex)exit(0);
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

int gcd(int a,int b){
	return b?gcd(b,a%b):a;
}

void Solve(){
	int a=read(),b=read(),c=read(),d=read();
	if(a<b)return No(0);
	if(d<b)return No(0);
	if(b<=c)return Yes(0);
	int e=(a-c)%b+b,f=gcd(b,d);
	e%=f;
	if(0<e&&e-(b-c)<0)return No(0);
	else if(0<e+f&&e+f-(b-c)<0)return No(0);
	else return Yes(0);
}

signed main(){
	int t=read();
	REP(_,t)
		Solve();
}


Measured memory_bytes: 256
import collections

# input
n, a = map(int, input().split())
X = [int(i) - a for i in input().split()]

S = collections.Counter([0, X[0]])
# Xから1枚以上選んで作ることが可能な和:作り方の場合の数
# 1枚も選ばない＝0:1通り
# X[0]のみ選ぶ＝X[0]:1通り

for i in X[1:]: # 選べるカードを増やしていく (X[0] ~ X[i] から選ぶ)
    S_temp = collections.Counter()
    for s, c in S.items():
        S_temp[s + i] += c # X[0] ~ X[i - 1] で作れる和に X[i] を足す
    S += S_temp

print(S[0] - 1) # 1枚も選ばないのはルール違反

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

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
//    static final long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // int d[]=new int[n];
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}

        int n=sc.nextInt(),m=sc.nextInt();
        long dp[]=new long[n];
        int ts[]=new int[n];
        int dg[]=new int[n];
        ArrayList<Integer> lis[]=new ArrayList[n];
        for (int i = 0; i < lis.length; i++) {
			lis[i] = new ArrayList<Integer>();
		}
        
        for (int i = 0; i < m; i++) {
			int from=sc.nextInt()-1, to=sc.nextInt()-1;
			lis[from].add(to);
			dg[to]++;
		}
        int c=0;
        for (int i = 0; i < n; i++) {
        	if(dg[i]==0)ts[c++]=i;
		}
        
        for (int i = 0; i < n; i++) {
//        	db(ts[i]);
			for (int j = 0,to; j < lis[ts[i]].size(); j++) {
				to = lis[ts[i]].get(j);
				if(--dg[to]==0) ts[c++]=to;
			}
		}
        long ans=0;
        for (int i = n-1; -1 < i; i--) {
        	int from=ts[i];
			for (int t = 0; t < lis[from].size(); t++) {
				dp[from]=max(dp[from],dp[lis[from].get(t)]+1);
			}
			ans=max(dp[from],ans);
		}
        
        out.println(ans);
        out.flush();
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }


    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

//class P implements Comparable<P>{
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//    public int compareTo(P p){
//        return d-p.d; //des
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 53400
#include<iostream>
using namespace std;
#define INF 9999999999

long long S[500005], L[250005], R[250005];
long long sum=0;

void merge(int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;
    for (int i=0; i<n1; i++) {
        L[i] = S[left + i];
    }
    for (int i=0; i<n2; i++) {
        R[i] = S[mid + i];
    }
    L[n1] = INF;
    R[n2] = INF;
    int i = 0, j = 0;
    for (int k=left; k<right; k++) {
        if (L[i] <= R[j]) {
            S[k] = L[i];
            i++;
        }
        else {
            S[k] = R[j];
            j++;
        }
        sum++;
    }
}

void mergeSort(int left, int right) {
    if (left + 1 < right) {
        int mid = (left + right) / 2;
        mergeSort(left, mid);
        mergeSort(mid, right);
        merge(left, mid, right);
    }
    return;
}

int main() {
    int n, i;
    cin >> n;
    for (i=0; i<n; i++) {
        cin >> S[i];
    }
    mergeSort(0, n);
    for (i=0; i<n; i++) {
        cout << S[i] << (i != n-1 ? " " : "\n");
    }
    cout << sum << endl;
}


Measured memory_bytes: 10788
#include <iostream>
#include <string.h>
using namespace std;
int eight_queen[8];
int final = 0;

bool check(int row, int value) {
	int data;
	for (int i = 0; i < 8; i++) {
		if (eight_queen[i] != -1) {
			data = eight_queen[i];
			if (value == data) return false;
			if ((value + row) == (data + i)) return false;
			if ((value - row) == (data - i)) return false;
		}
	}
	return true;
}

void print() {
	for (int j = 0; j < 8; j++) {
		for (int i = 0; i < 8; i++) {
			if (i == eight_queen[j])
				cout << "Q";
			else
				cout << ".";
		}
		cout << endl;
	}
}

void solution(int row) {
	if (row > 7 && (eight_queen[7] != -1)) {
		print();
		return;
	}

	if (eight_queen[row] != -1 ) solution(row + 1);
	else {
		for (int index = 0; index < 8; index++) {	
			if (check(row, index)) {
				eight_queen[row] = index;
				solution(row + 1);
				eight_queen[row] = -1;
			}
		}
	}
}



int main() {
	int n;
	cin >> n;
	int row, index;
	memset(eight_queen, -1, sizeof(eight_queen));
	for (int i = 0; i < n; i++) {
		cin >> row >> index;
		eight_queen[row] = index;
	}
	solution(0);
	return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
    int n,m;cin>>n>>m;
    vii a(m);
    rep(i,m){
        cin>>a[i].F>>a[i].S;
    }
    sort(all(a));
    rep(i,m-1){
        if(a[i].F==a[i+1].F&&a[i].S!=a[i+1].S){
            cout<<-1<<endl;
            return 0;
        }
    }
    string t="";
    rep(i,n){
        t.PB('?');
    }
    rep(i,m){
        string s=to_string(a[i].S);
        t[a[i].F-1]=s[0];
    }
    if(n>1&&t[0]=='0'){cout<<-1<<endl;return 0;}
    if(n==1&&t[0]=='?'){cout<<0<<endl;return 0;}
    if(t[0]=='?'&&n>1){t[0]='1';}
    for(int i=1;i<n;++i){
        if(t[i]=='?'){
            t[i]='0';
        }
    }
    cout<<t<<endl;
}


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

using namespace std;

#define ll long long
#define ull unsigned ll
#define all(x) x.begin(), x.end()
const int M = 1e9 + 7;


int main() {
    int n, l;
    cin >> n >> l;
    int a[n];
    int sum = 0;
    for (int i = 0; i < n; ++i) {
        a[i] = l + i;
        sum += a[i];
    }
    int df = INT_MAX, ans;

    for (int j = 0; j < n; ++j) {
        ll d = sum - a[j];
        if (abs(d - sum) < df) {
            ans = d;
            df = abs(d - sum);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repq(i,a,n) for(int i=a; i<=n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

template<typename T>
class bit{
    public:
        T array[(1 << 17) + 1];
        int n;
        bit(int m) {n = m;}

        // 0???????????? i???????????§????´???????????±???????
        T sum(int i) {
            T s = 0;
            while(i > 0) {
                s += array[i];
                i -= i & -i;
            }
            return s;
        }

        // ?????? [i, j] ???????´??????????
        T sum(int i, int j) {
            int ret_i;
            if(i != 0) ret_i = sum(i-1);
            else ret_i = 0;
            int ret_j = sum(j);
            return ret_j - ret_i;
        }

        // i????????? ????´? x ?????????
        void add(int i, T x) {
            while(i <= n) {
                array[i] += x;
                i += i & -i;
            }
        }
};

int main() {
    int n, q; cin >> n >> q;
    bit<int> b(n);
    int c, x, y;
    rep(i,0,q) {
        cin >> c >> x >> y;
        if(c == 0) b.add(x, y);
        else {
            int ans = b.sum(x, y);
            cout << ans << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3468
n=input()
l=len(n)
b=False
for i in range(l-2):
  if n[i]==n[i+1]:
    b=True
    s=i+1
    g=i+2
    break
  elif n[i]==n[i+2]:
    b=True
    s=i+1
    g=i+3
    break
if n[-1]==n[-2]:
  s=l-1
  g=l
  b=True
if b:
  print(s,g)
else:
  print(-1,-1)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using vb = vector<bool>;
using boolGraph = vector<vb>;
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main() {
  int N; cin >> N;
  vi a(N), b(N);
  rep(i,N) cin >> a[i];
  rep(i,N) cin >> b[i];

  bitset<29> ans(0);

  map<int, int> mod_a, mod_b;
  rep(i,N) ++mod_a[a[i]];
  rep(i,N) ++mod_b[b[i]];

  for (int i=28; i>=0; --i) {
    vi clear_a, clear_b;

    for (auto j=mod_a.rbegin(); j!=mod_a.rend(); ++j) {
      if ((*j).first >= (1<<i)) {
        if ((*j).second % 2) {
          if (N%2) ans.flip(i);
          ++mod_a[(*j).first - (1<<i)];
        }
        clear_a.push_back((*j).first);
      }
      else break;
    }
    for (auto v : clear_a) mod_a.erase(v);

    for (auto j=mod_b.rbegin(); j!=mod_b.rend(); ++j) {
      if ((*j).first >= (1<<i)) {
        if ((*j).second % 2) {
          if (N%2) ans.flip(i);
          ++mod_b[(*j).first - (1<<i)];
        }
        clear_b.push_back((*j).first);
      }
      else break;
    }
    for (auto v : clear_b) mod_b.erase(v);

    int tmp = 0;
    auto iter = mod_b.rbegin();
    auto e = mod_b.rend();
    
    for (auto p : mod_a) {
      while (iter != e && p.first + (*iter).first >= (1<<i)) {
        tmp ^= (*iter).second % 2;
        ++iter;
      }
      if ((p.second % 2) & tmp) ans.flip(i);
    }
  }

  cout << ans.to_ullong() << endl;
  return 0;
}


Measured memory_bytes: 26360
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;



int main(){
    string s;
    cin >> s;
    if(s.at(2)==s.at(3) && s.at(4)==s.at(5)){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;

   

}

Measured memory_bytes: 3600
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

ans = []
l = range(1, N + 1)
import itertools

c = 0
for v in itertools.permutations(l, N):
    if list(v) == P:
        a = c
    if list(v) == Q:
        b = c
    c += 1

print(abs(b - a))


Measured memory_bytes: 3060
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}

ll gcd(ll(a), ll(b)) {
	ll k = a;
	ll l = b;
	ll j = 0;
	while (l != 0) {
		j = k % l;
		k = l;
		l = j;
	}
	return k;
}



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

	int K;
	cin >> K;
	int i = 0;
	set<string> bu;
	while (i < 5 && i < s.size()) {
		rep(j, s.size() - i) {
			bu.insert(s.substr(j, i+1));
			
			
		}
		i++;
	}
	rep(j, K - 1) {
	
		bu.erase(*begin(bu));
	}

	cout << *begin(bu) << endl;

	
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
#define dump(X) cout << #X << ' ' << X << endl
#define pe(X) cout << X << endl
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int main(){
	int N,A,B;
	cin >> N >> A >> B;
	pe(min(N*A,B));
	return 0;
}

Measured memory_bytes: 256
function Main(input) {
  input = input.split('\n')
  var N = input[0]
  var a = input[1].split(' ')
  var flag = true
  a = a.map(x => parseInt(x))

  var ans = a[0]

  for (var i = 1; i < N; i++) {
    ans ^= a[i]
  }

  console.log(ans === 0 ? 'Yes' : 'No')
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 21064
n,k,q = map(int,input().split())
a = [0 for  _ in range(q)]
point = [0 for _ in range(n)]

for i in range(q):
    a[i] = int(input())

for i in range(q):
    point[a[i]-1] += 1

for i in range(n):
    if(point[i] > q-k):
        print("Yes")
    else:
        print("No")

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

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

Measured memory_bytes: 3592
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>
#include <bitset>

using ll = long long int;
using ul = unsigned long long int;

namespace lamlib
{
	// Absolute
	template<class T> inline T abs(const T &a){ return (a>0) ? a : -a; }
	// GCD: a > b
	ul gcd(ul a,ul b) { return (!b) ? a : gcd(b,a%b); }
}

int main(int argc,char *argv[])
{
	ll n;
	std::cin >> n;

	std::vector<ll> p(n,0);
	for(ll i = 0;i < n;++i) std::cin >> p[i];
	std::vector<ll> q(n,0);
	for(ll i = 0;i < n;++i) std::cin >> q[i];

	std::vector<ll> cp = q;

	std::sort(cp.begin(),cp.end(),std::less<>());

	ll cnt = 0;
	ll a = 0,b = 0;
	do
	{
		ll a_judge = 0, b_judge = 0;
		++cnt;
		for(ll i = 0;i < n;++i)
		{
			if(cp[i] == p[i]) ++a_judge;
			if(cp[i] == q[i]) ++b_judge;
		}
		if(a_judge == n) a = cnt;
		if(b_judge == n) b = cnt;
	}while(std::next_permutation(cp.begin(),cp.end()));

	std::cout << abs(a-b) << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int a,b,c;
	cin>>a>>b>>c;
    if(a==b && b!=c)
     cout<<"Yes";
    else if(b==c && b!=a)
     cout<<"Yes";
    else if(a==c && b!=a)
     cout<<"Yes";
    else
     cout<<"No";
    return 0;
	
}

Measured memory_bytes: 3664
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

const MaxA = 1_000_000

func main() {
	sc := NewScanner()

	n := sc.ReadInt()
	as := make([]int, n)
	for i := 0; i < n; i++ {
		as[i] = sc.ReadInt()
	}

	sieve := make([]int, MaxA+1)
	for _, a := range as {
		sieve[a]++
		if sieve[a] == 1 {
			for i := a * 2; i <= MaxA; i += a {
				sieve[i]++
			}
		}
	}

	count := 0
	for _, a := range as {
		if sieve[a] == 1 {
			count++
		}
	}

	fmt.Println(count)
}

// from [my library](https://github.com/ikngtty/go-contestlib)
// -   math/simple

func Abs(x int) int {
	if x >= 0 {
		return x
	}
	return -x
}

func Min(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}

	min := values[0]
	for _, v := range values {
		if v < min {
			min = v
		}
	}
	return min
}

func Max(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}

	max := values[0]
	for _, v := range values {
		if v > max {
			max = v
		}
	}
	return max
}

func Pow(base, exponent int) int {
	if exponent < 0 {
		panic(fmt.Sprintf("exponent (%d) should not be a minus", exponent))
	}

	answer := 1
	for i := 0; i < exponent; i++ {
		answer *= base
	}
	return answer
}

func Ceil(divident, dividor int) int {
	if dividor == 0 {
		panic("dividor should not be 0")
	}

	quo := divident / dividor
	rem := divident % dividor

	if rem != 0 {
		if (divident > 0 && dividor > 0) ||
			(divident < 0 && dividor < 0) {
			return quo + 1
		}
	}
	return quo
}

// -   sortutil

func ReverseInts(a []int) {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
}

func ReverseStrings(a []string) {
	sort.Sort(sort.Reverse(sort.StringSlice(a)))
}

// -   io

type Scanner struct {
	bufScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bufSc := bufio.NewScanner(os.Stdin)
	bufSc.Split(bufio.ScanWords)
	bufSc.Buffer(nil, 100000000)
	return &Scanner{bufSc}
}

func (sc *Scanner) ReadString() string {
	bufSc := sc.bufScanner
	bufSc.Scan()
	return bufSc.Text()
}

func (sc *Scanner) ReadInt() int {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.Atoi(text)
	if err != nil {
		panic(err)
	}
	return num
}


Measured memory_bytes: 13132
import java.util.*;
import java.io.*;
public class Main {
    public static int solve(int arr[][]){
        int n = arr.length;
        int m = arr[0].length;
        int dp[][] = new int[n][m];
        dp[0][0] = 1;

        for(int i = 0 ; i < n ; i++){
            for(int j = 0 ; j < m ; j++){
                int ans = 0;
                if(i-1 >= 0 && arr[i-1][j] != 1){
                    ans = dp[i-1][j];
                }
                if(j-1 >= 0 && arr[i][j-1] != 1){
                    ans += dp[i][j-1];
                }
                dp[i][j] += ans % 1000000007;
            }
        }
        return dp[n-1][m-1];
    }
    public static void main(String args[]) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int m =s.nextInt();
        int arr[][] = new int[n][m];
        for(int i = 0 ; i < n ; i++){
            String str = s.next();
            for(int j = 0 ; j < str.length() ; j++){
                char a = str.charAt(j);
                if(a == '#'){
                    arr[i][j] = 1;
                }
            }
        }        
        System.out.println(solve(arr));
    }
}

Measured memory_bytes: 49240
while 1:
    n = int(input())
    if n == 0:break
    y = int(input())
    mv = 0
    for i in range(n):
        b,r,t = list(map(int,input().split()))
        if t == 1:
            spam = 1 + y*(r/100)
        else:
            spam = (1+(r/100))**y
        if spam > mv:
            result = b
            mv = spam

    print(result)

Measured memory_bytes: 6820
import java.util.*;
public class Main {
	static Scanner sc=new Scanner(System.in);
	public static void main(String args[]) {
		int N=sc.nextInt(),res=0;
		for(int i=0;i<N;i++) {
			long temp=sc.nextLong();
			while((temp&1)==0) {
				res++;
				temp=temp>>1;;
			}
		}
		System.out.println(res);
	}
}

Measured memory_bytes: 48672
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll dp[101][100001];
ll rec(ll n,ll w,ll num[],ll weight[])
{

  if(n<0)
  {
    return 0;
  }
  if(w<0)
  {
    return 0;
  }

  if(dp[n][w]!=-1)
  { //cout<<"Take from here "<<endl;
    return dp[n][w];
  }
  
  if(num[n]>w)
  {
    dp[n][w]=rec(n-1,w,num,weight);
    return dp[n][w];
  }
else{
     //cout<<"n "<<n<<"dp"<<dp[n]<<endl;
  dp[n][w] =max(rec(n-1,w,num,weight),rec(n-1,w-num[n],num,weight)+weight[n]);
  //cout<<"After "<<endl;
  //cout<<"value "<<w<<endl;
  //cout<<"n "<<n<<"dp"<<dp[n][w]<<endl;
  return dp[n][w];
}
 
}

int main()
{
  ll n,w;
  cin>>n>>w;

  memset(dp,-1,sizeof(dp));
  ll num[n];
  ll weight[n];
  for(int i=0;i<n;i++)
  {
    int a,b;
    cin>>a>>b;
    num[i]=a;
    weight[i]=b;
  }

  cout<<rec(n-1,w,num,weight)<<endl;
}


Measured memory_bytes: 82396
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 14 18:32:27 2020

@author: liang
"""
"""
配列のスライス
X[0:-(N-1)]などで切ると、N=1の時にバグるので注意
X[0:len(X) - (N-1)]のように要素数-後ろから数えたindexとする

"""
N, M = map(int, input().split())
X = [int(x) for x in input().split()]

def solve():
    if N >= M :
        return 0
    X.sort()
    d = [X[i+1] - X[i] for i in range(M-1)]
    d.sort()
    #print(X)
    #print(d)
    return sum(d[0:M-N])
print(solve())

Measured memory_bytes: 20060
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
long long f[2002][2002],n,a[2002],x;//f[i][j]:使用j次魔法，获得color i的最小花费的时间（不包括k*x）
int main()
{
	scanf("%lld%lld",&n,&x);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	for(int i=1;i<=n;i++)
	{
		f[i][0]=a[i];
		for(int j=1;j<n;j++)
		{
			int pos=i-j;
			if(pos<=0)pos=n+pos;
			f[i][j]=min(f[i][j-1],a[pos]);
		}
	}
	long long ans=1LL<<60LL,h;
	for(int j=0;j<n;j++)
	{
		h=0;
		for(int i=1;i<=n;i++)
			h+=f[i][j];
		ans=min(ans,h+x*j);
	}
	printf("%lld",ans);
}

Measured memory_bytes: 31488
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<int> c(n, 0), s(n, 0), f(n, 0);
    for (int i = 0; i < n - 1; ++i) {
        cin >> c[i] >> s[i] >> f[i];
    }

    vector<int> t;
    for (int i = 0; i < n - 1; ++i) {
        t = vector<int>(n, 0);
        for (int j = i + 1; j < n; ++j) {
            int tmp = max(0, (t[j - 1] - s[j - 1] + f[j - 1] - 1) / f[j - 1]);
            t[j] = s[j - 1] + f[j - 1] * tmp + c[j - 1];
        }

        cout << t[n - 1] << endl;
    }

    cout << 0 << endl;
}

Measured memory_bytes: 256
import sys
w = int(input())
n = int(input())

state = list(range(1, w+1))

a = [None] * (n)
b = [None] * (n)
for i,line in enumerate(sys.stdin.readlines()):
   a[i], b[i] = map(int, line.split(","))

def swap(x, y):
    global state 
    temp = state[x-1]
    state[x-1] = state[y-1]
    state[y-1] = temp


for i in range(n):
    swap(a[i], b[i])

for x in state:
    print(x)

Measured memory_bytes: 7584
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

int main(){
	long long n,p;
	cin >> n >> p;
	if(n == 1){
		cout << p << endl;
		return 0;
	}
	long long ret = 1;
	for(ll i = 2 ; i*i <= p ; i ++){
		if(p%i == 0){
			int cnt = 0;
			while(p%i == 0){
				cnt ++;
				p /= i;
			}
			while(cnt >= n){
				cnt -= n;
				ret *= i;
			}
		}
	}
	cout << ret << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0; i<N; i++){
    cin >> A[i];
  }
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  int Alice = 0;
  int Bob = 0;
  int j=0;
  while(j<N){
    Alice += A[j];
    j++;
    Bob += A[j];
    j++;
  }
  cout << Alice - Bob << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, d;
int32_t main(){_

   cin>>n>>d;

   int ans = inf;
   for (int i = 0; i < (1LL<<n); ++i)
   {
      vector<int> v(n);
      for (int j = 0; j < n; ++j)
      {
         if(i & (1LL << j))
            v[j] = 1;
      }

      int curr = __builtin_popcountll(i);

      vector<int> tmp = v;
      for (int i = 0; i < n; ++i)
      {
         if(v[i] == 0)continue;
         for (int j = max(0LL, i-d); j <= i; ++j)
            tmp[j] = 1;
         for (int j = i; j <= min(n-1, i+d); ++j)
            tmp[j] = 1;
      }

      bool good = 1;
      for(auto i: tmp)
         good &= (i == 1);

      if(good){
         smin(ans, curr);
      }
   }

   cout<<ans;

   return 0;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
S = list(input())
from itertools import accumulate

Es = [0]*(N+1)
Ws = [0]*(N+1)
for i, s in enumerate(S, 1):
    if s=='E':
        Es[i] = 1
    else:
        Ws[i] = 1
Es = list(accumulate(Es))
Ws = list(accumulate(Ws))

ans = 10**18
for i in range(1, N+1):
    w = Ws[i-1]
    e = (Es[-1]-Es[i])
    ans = min(ans, w+e)
print(ans)

Measured memory_bytes: 137028
#include<iostream>
#include<vector>
#include<algorithm>
signed main(){
  int n;
  std::cin>>n;
  std::vector<int> a(n);
  for(auto& ai:a)std::cin>>ai;
  auto b = a;
  std::sort(std::begin(b),std::end(b),std::greater<>());
  for(auto ai:a){
    if(ai==b[0])std::cout<< b[1] <<std::endl;
    else std::cout<< b[0] <<std::endl;
  }
}

Measured memory_bytes: 4856
n = int(input())
a = list(map(int, input().split()))
num_dic = {}
for i in a:
    if i in num_dic:
        num_dic[i]+=1
    else:
        num_dic[i] = 1
pre_ans = 0
for k,v in num_dic.items():
    pre_ans+=v*(v-1)//2
for num in a:
    tmp = num_dic[num]
    ans = pre_ans - (tmp-1)
    print(ans)

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

vector<ll> dp(100000,E);
const vector<ll> A={1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000};

map<pll,ll> M;

ll dfs(ll a,ll d){
    if(d==-1){return 0;}
    if(M.count({a,d})){return M[{a,d}];}
    //if(d<=4){return dp[a];}
    ll k=10-a/A[d]%10;
    k%=10;
    ll w=a;
    ll ans=E;
    for(ll i=d;i>=0;i--){
        w-=w/A[i]%10*A[i];
        w+=(a/A[i]+k)%10*A[i];
        ans=min(ans,dfs(w,d-1)+(k==0?0:1));
    }
    return M[{a,d}]=ans;
}


int main(){
    dp[0]=0;
    queue<ll> Q;
    Q.push(0);
    while(!Q.empty()){
        ll w=Q.front(); Q.pop();
        for(int l=0;l<5;l++){
            for(int r=l;r<5;r++){
                for(int h=0;h<10;h++){
                    ll ret=w;
                    for(int j=l;j<=r;j++){
                        ret-=w/A[j]%10*A[j];
                        ret+=(w/A[j]+h)%10*A[j];
                    }
                    if(dp[ret]>dp[w]+1){dp[ret]=dp[w]+1; Q.push(ret);}
                }
            }
        }
    }
    
    ll k;
    while(cin>>k){
        if(k==0){return 0;}
        string s,t;
        cin>>s>>t;
        ll S=0;
        for(int i=0;i<k;i++){
            s[i]+=10-t[i];
            s[i]%=10;
            S*=10;
            S+=s[i];
        }
        cout<<dfs(S,k-1)<<endl;
    }
    
    
    return 0;
}



Measured memory_bytes: 5580
#include<bits/stdc++.h>
	#include<ext/pb_ds/assoc_container.hpp>
	#include<ext/pb_ds/tree_policy.hpp>
	#define reduce200ms ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
	#define dofloat cout<<fixed<<setprecision(6)
	#define pb push_back
	#define mp make_pair
	#define ff first
	#define ss second
	#define bitcount _builtin_popcount
	#define fill(var,val) memset(var,val, sizeof var)
	#define rep(i,a,b) for(auto i=a;i<b;++i)
	#define per(i,a,b) for(auto i=a;i>b;--i)
	#define elif else if
	#define all(vec) vec.begin(),vec.end()
	#define rall(vec) vec.rbegin(),vec.rend()
	/*
	    #ifdef DEBUG
	         #define debug(args...)            {dbg,args; cerr<<endl;}
	    #else
	        #define debug(args...)
	    #endif
	    struct debugger
	    {
	        template<typename T> debugger& operator , (const T& v)
	        {
	            cerr<<v<<" ";
	            return *this;
	        }
	    } dbg;
	*/
	using namespace __gnu_pbds;
	using namespace std;
	
	typedef long long ll;
	typedef long double ld;
	typedef vector<long long> vl;
	typedef pair<long long,long long> pll;
	typedef vector<pair<long long,long long> > vll;
	typedef vector<pair<int,int> > vii;
	typedef vector<int> vi;
	typedef pair<int,int> ii;
	
	
	const long long MOD=1000000007;
	const long long MAX=100005;
	const long double PI=3.14159265359;
	const long double G=9.807;
	const long long INF=1e18;
	const long double EPS=1e-6;
	
	long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
	long double dist(long long a,long long b,long long c,long long d){return sqrt( ((a)-(c))*((a)-(c))+((b)-(d))*((b)-(d)) );}
	long long min(long long a,long long b,long long c){return min(c,min(a,b));}
	long long max(long long a,long long b,long long c){return max(c,max(a,b));}
	bool isprime(long long a){
	if(a==2)return 1;
	if(!(a&1))return 0;
	for(ll i=3;i*i<=a;i+=2){
		if(a%i==0)return 0;
	}
	return 1;
	}
	long long mpow(long long base,long long exponent,long long modulus){
	if(modulus==1)return 0;
	long long result = 1;
	base=base%modulus;
	while(exponent){
			if(exponent%2 == 1)
				result=(result*base)%modulus;
			exponent=exponent>>1;
			base=(base*base)%modulus;
		}
	return result;
	}
	ll minv(ll a,ll mod){
		ll _gcd=gcd(a,mod);
		if(_gcd!=1)cerr<<"WA";
		else return mpow(a,mod-2,mod);
	}
	/*template <typename T>
	using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
	
	//int dc[]={1,0,-1,0,1,1,-1,-1};
	//int dr[]={0,-1,0,1,1,-1,-1,1};
	
	/*void sieve(int N){
		for(int i=0;i<=N;i++){
			spf[i]=i;
		}
		for(int i=2;i*i<=N;i++){
			if(spf[i]==i){
				for(int j=i*i;j<=N;j+=i){
					spf[j]=min(spf[j],i);
				}
			}
		}
		return;
	}*/
	
	/*
	void nCr(ll n,ll k){
		ll i,j;
		for(i=0;i<=n;i++){
			for(j=0;j<=min(i,k);j++){
	
				if(j==0 or j==i)C[i][j]=1LL;
				else  C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD;
	
			}
		}
		return;
	}*/
	ll n,m;
int main(){reduce200ms;
cin>>n>>m;
string s,t;cin>>s>>t;
ll sman=n/gcd(n,m);
ll smam=m/gcd(n,m);
ll g=gcd(n,m);
ll l=n*m/g;
if(s[0]!=t[0]){
	cout<<-1;
	return 0;
}
for(ll i=1;i*sman<=n-1 and i*smam<=m-1;i++){
	if(s[i*sman]!=t[i*smam]){
		cout<<-1;
		return 0;
	}
}
cout<<l;
return 0;
}	

Measured memory_bytes: 640
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	Scanner sc = new Scanner(System.in);
	public void run() {
		while(sc.hasNext()){
			int n = sc.nextInt();
			if(n == 0) break;
			else calc(n);
		}
	}
	public void calc(int n){
		ArrayList<String[]> list = new ArrayList<String[]>();
		for(int i = 0; i < n; i++){
			String L = sc.next();
			int P = sc.nextInt();
			int A = sc.nextInt();
			int B = sc.nextInt();
			int C = sc.nextInt();
			int D = sc.nextInt();
			int E = sc.nextInt();
			int F = sc.nextInt();
			int S = sc.nextInt();
			int M = sc.nextInt();
			
			double time = A + B + C+ (D + E) * M;
			double money = F * S * M - P;
			
			double kouritsu = money / time;
			
			list.add(new String[]{L, String.valueOf(kouritsu)});
		}
		ArrayList<String[]> a = mergeSort(list);
		for(int i = 0; i < a.size(); i++){
			System.out.println(a.get(i)[0]);
		}
		System.out.println("#");
	}

	public ArrayList<String[]> mergeSort(ArrayList<String[]> list){
		if(list.size() > 1){
			int m = list.size() / 2;
			int n = list.size() - m;
			ArrayList<String[]> a1 = new ArrayList<String[]>();
			ArrayList<String[]> a2 = new ArrayList<String[]>();
			for(int i = 0; i < m; i ++) a1.add(list.get(i));
			for(int i = 0; i < n; i++) a2.add(list.get(i + m));
			a1 = mergeSort(a1);
			a2 = mergeSort(a2);
			return merge(a1, a2);
		}
		else return list;
	}
	public ArrayList<String[]> merge(ArrayList<String[]> a1, ArrayList<String[]> a2){
		int i = 0;
		int j = 0;
		ArrayList<String[]> a = new ArrayList<String[]>();
		while(i < a1.size() || j < a2.size()){
			if(i < a1.size() && 
					(j >= a2.size() || 
					Double.valueOf(a1.get(i)[1]) > Double.valueOf(a2.get(j)[1]) || 
					(a1.get(i)[1].equals(a2.get(j)[1]) && a1.get(i)[0].compareTo(a2.get(j)[0]) < 0))){
				a.add(a1.get(i));
				i++;
			}
			else{
				a.add(a2.get(j));
				j++;
			}
		}
		return a;
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 55512
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
 string N,K,J;
 int l;
    cin >> N;
   l = count(N.cbegin(), N.cend(), 'x');
    if( l <= 7 ){
    cout << "YES";
    }else{
    cout << "NO";    
    return 0;
    }
}

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

int main() {
    int debt = 100000, n;
    cin >> n;

    while (n--) {
        debt *= 1.05;
        debt = (debt + 999) - (debt + 999) % 1000;
    }

    cout << debt << endl;
    
    return 0;
}


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

using ll = long long;

int main() {
    int N, A;
    ll S = 0;
    map<ll, ll> mp;
    mp[0] = 1;
    cin >> N;
    rep(i, N) {
        cin >> A;
        S += A;
        mp[S]++;
    }
    ll ans = 0;
    for (auto i : mp) {
        ans += i.second * (i.second - 1) / 2;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 12800
use std::collections::HashMap;

fn main(){
  let n: usize = read();
  let v: Vec<i64> = read_vec();
  let mut sv: Vec<i64> = vec![0;n+1];

  for i in 0..n {
    sv[i+1] = sv[i] + v[i]
  }

  let mut hm: HashMap<i64,i64> = HashMap::new();

  for &x in sv.iter() {
    let cnt = hm.entry(x).or_insert(0);
    *cnt += 1;
  }

  let mut ans: i64 = 0;

  for (_, &val) in hm.iter() {
    ans += val * (val - 1) / 2;
  }
  
  println!("{}", ans);
}

fn read<T>() -> T
  where T: std::str::FromStr,
        T::Err: std::fmt::Debug
{
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).expect("failed to read");
  buf.trim().parse().unwrap()
}

fn read_vec<T>() -> Vec<T>
  where T: std::str::FromStr,
        T::Err: std::fmt::Debug
{
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).expect("failed to read");
  buf.split_whitespace().map(|e| e.parse().unwrap()).collect()
}


Measured memory_bytes: 20492
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(int)(a); i!=(int)(b); i++)
#define RFOR(i, a, b) for(int i=(int)(a); i!=(int)(b); i--)
#define REP(i, n) FOR(i, 0, n)
using namespace std;
using ll = long long;

constexpr int mod = 1e9+7, lim = 1e5*2;

vector<pair<int, int>> v;
ll fac[lim+1], rfac[lim+1];

ll m_pow(ll x, ll n){
  if(n == 0) return 1;
  return m_pow(x*x%mod, n/2) * ((n%2)?x: 1) % mod;
}

void init_fac(){
  fac[0] = 1;
  FOR(i, 1, lim+1) (fac[i] = fac[i-1] * i) %= mod;

  rfac[lim] = m_pow(fac[lim], mod-2);
  RFOR(i, lim-1, -1) (rfac[i] = rfac[i+1] * (i+1)) %= mod;
}

void init_v(int n){
  for(int i=2; n != 1; i++){
    int cnt = 0;
    while(n % i == 0){
      cnt++;
      n /= i;
    }
    v.push_back({i, cnt});
  }
}

ll comb(ll n, ll r){
  if(n==r || r == 0) return 1;
  return (fac[n] * rfac[n-r]) % mod * rfac[r] % mod;
}

int main(){
  int n, m; cin >> n >> m;

  init_fac();
  init_v(m);

  ll ans = 1;
  REP(i, v.size()){
    if(v[i].second){
      (ans *= comb(n+v[i].second-1, v[i].second)) %= mod;
    }
  }

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


Measured memory_bytes: 528724
s = list(input())
l = [chr(i) for i in range(ord("a"), ord("z") + 1)]
if len(s) == 26:
    if s == l[-1::-1]:
        print(-1)
        exit()
    else:
        for i in range(26)[-2::-1]:
            for j in range(25, i, -1):
                if s[i] < s[j]:
                    s[i] = s[j]
                    print("".join(s[:i+1]))
                    exit()
for i in range(26)[-1::-1]:
    if l[i] in s:
        del l[i]
s.append(l[0])
print("".join(s))

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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int N = 100005;

int n;

int main() {

	FAST;

	string s;
	cin >> n >> s;
	int x = 0, ans = INT_MIN;
	for (int i = 0; i < n; i ++) {
		ans = max(ans, x);
		if (s[i] == 'I') x ++;
		else x --;
	}
	ans = max(ans, x);
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define ll long long
#define P pair<int, int>
#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define GI(name) \
  int(name);     \
  scanf("%d", &(name))
#define GI2(name1, name2) \
  int(name1), (name2);    \
  scanf("%d %d", &(name1), &(name2))
#define GI3(name1, name2, name3) \
  int(name1), (name2), (name3);  \
  scanf("%d %d %d", &(name1), &(name2), &(name3))
#define GVI(name, size)    \
  vector<int>(name)(size); \
  FOR(i, (size)) scanf("%d", &(name)[i])
#define GS(name) \
  string(name);  \
  cin >> (name);
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  FOR(i, v.size() - 1) { ret += to_string(v[i]) + ","; }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  GI(N);
  GVI(T, N);
  GI(M);
  int sum = accumulate(ALL(T), 0);
  FOR(i, M) {
    GI2(p, X);
    print(sum - T[p - 1] + X);
  }
  return 0;
}

Measured memory_bytes: 256
from functools import reduce

def numofbits(x):
    ret = 0
    while x > 0:
        ret += (x & 1)
        x >>= 1
    return ret

H,W,K = map(int, input().split())
c = []
bk = 0
for i in range(H):
    c.append(reduce(lambda x,y: 2*x+y, map(lambda x: 1 if x == '#' else 0, input())))
#print(c)

def f(x):
    ret = 0
    for j in range(2**W):
        r = 0
        for i in x:
            r += numofbits(i & j)
        if r == K:
            #print(x,bin(j))
            ret += 1
    return ret

ans = 0
for i in range(2**H):
    x = []
    for j in range(H):
        if i & 2**j:
            x.append(c[j])
    #print("@",bin(i),x)
    ans += f(x)

print(ans)


Measured memory_bytes: 9440
#include <stdio.h>
#include <iostream>
#include <string>
int main(void)
{
	char s;
	std::cin >> s;
	if (s == 'a' ||s=='i'|| s=='u'||s== 'e'||s== 'o')
	{
		std::cout << "vowel";
	}
	else
	{
		std::cout << "consonant";
	}
	return 0;
}
	

		
	

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

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (int) n; i++)
#define reps(i, n) for (int i = 1; i <= (int) n; i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) x.erase(unique(all(x)), x.end());
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << x << endl
using vint=vector<int>;
using vvint=vector<vint>;
using pint=pair<int, int>;
using vpint=vector<pint>;
constexpr double pi = 3.1415926535897932384626433832795028;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
inline int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> using priority_queue_rev=priority_queue<T, vector<T>, greater<T>>;
template<typename T1, typename T2> inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> inline bool chmin(T1 &a, const T2 &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct Setup {
    static constexpr int PREC = 20;
    Setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N;
signed main() {
    cin >> N;
    if ((N & (N - 1)) == 0) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    for (int i = 2; i <= N - 1 + N % 2; i++) {
        cout << "1 " << i << endl;
        cout << i << " " << i + 1 - i % 2 * 2 + N << endl;
    }
    cout << N + 1 << " " << N + 2 << endl;
    if (N % 2 == 0) {
        cout << N << " " << (N ^ (N - 1) ^ 1) << endl;
        cout << 2 * N << " " << N - 1 << endl;
    }
}

Measured memory_bytes: 2304
get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_number(A, B) :-
    get_number(A),
    get_number(B).

get_number(A, B, C) :-
    get_number(A, B),
    get_number(C).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n', '', _, String).

get_chars(Xs) :-
    get_string(S),
    string_chars(S, Xs).

/* memo
    code(int)
    string_code(1, S, C), (C: code)
    char_code(X, Y) (X: char, Y: code)
    string_chars(S, S2) (S: string, S2: [char])
    to_lower(C, C2) (C: char? C2: code?)
    sub_string

    f(0, [], []).
    f(Z, [X|Xs], [Y|Ys]) :- X = Y, f(Z1, Xs, Ys), Z is Z1 + 1.
    f(Z, [_|Xs], [_|Ys]) :- f(Z, Xs, Ys).

    match: =, \=

    numeric: <,=<, >, >= (eval)
    lexicographically: @<. @=<, @>, @>=
    value?: =:=, =\= (eval)
    identical: ==, \==
*/

f(1, A, A, A).
f(2, A, A, B).
f(2, A, B, A).
f(2, B, A, A).
f(3, _, _, _).

main :-
    get_number(A),
    get_number(B),
    get_number(C),
    f(X, A, B, C),
    writeln(X).


Measured memory_bytes: 8132