akhauriyash/Code-Regression huggingface dataset:
//#define NDEBUG

#include <bits/stdc++.h>
#include <bits/extc++.h>

#define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define iter(a) a.begin(), a.end()
#define riter(a) a.rbegin(), a.rend()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(riter(a))
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define pf(a) push_front(a)
#define pob pop_back()
#define pof pop_front()
#define mp(a, b) make_pair(a, b)
#define F first
#define S second
#define mt make_tuple
#define gt(t, i) get<i>(t)
#define iceil(a, b) ((a + b - 1) / b)
#define tomax(a, b) (a = max(a, b))
#define printv(a, b) {bool pvaspace=false; \
for(auto pva : a){ \
    if(pvaspace) b << " "; pvaspace=true;\
    b << pva;\
}\
b << "\n";}

//#define TEST

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<ld, ld>;
using tiii = tuple<int, int, int>;

const ll MOD = 1000000007;
const ll MAX = 2147483647;

template<typename A, typename B>
ostream& operator<<(ostream& o, pair<A, B> p){
    return o << '(' << p.F << ',' << p.S << ')';
}

int main(){
    StarBurstStream

    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    for(int i = k; i < n; i++){
        if(a[i - k] < a[i]) cout << "Yes\n";
        else cout << "No\n";
    }

    return 0;
}

Measured memory_bytes: 3936
import java.util.*;

public class Main{
    Scanner in = new Scanner(System.in);

    int findMax(int n){
        int max = Integer.MIN_VALUE;
        int[] a = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = in.nextInt();
        }
        for(int i = 0; i < n; i++){
            int sum = 0;
            for(int j = i; j < n; j++){
                sum += a[j];
                max = Math.max(max, sum);
            }
        }
        return max;
    }

    void solve(){
        int n = in.nextInt();
        while(n != 0){
            System.out.println(findMax(n));
            n = in.nextInt();
        }
    }
    
    public static void main(String[] args){
        new Main().solve();    
    }
}

Measured memory_bytes: 34660
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int R = sc.nextInt();
		int d = sc.nextInt();

		int ans = 0;
		for(int i=N;i<R+1;i++){
			if(i%d==0){ans++;}
		}

		System.out.println(ans);
	}
}

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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    int n;cin>>n;
    vl a(n);
    set<int> s;
    int vmax=0;
    rep(i,n){
        cin>>a[i];
        if(a[i] >= 3200)vmax++;
        else s.insert(a[i]/400);
    }
    int m = s.size();
    cout << max(m,1) << " " << s.size()+vmax << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
#ifndef STOP_DEBUG
#define debug(...)\
    do { cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_cerr(__VA_ARGS__); cerr << noboolalpha; } while (0)
#else
#define debug(...)
#endif
void debug_cerr(){ cerr << '\n'; }
template<class Head, class... Tail>
void debug_cerr(Head head, Tail... tail){
  cerr << ' ' << head;
  debug_cerr(tail...);
}
void chmax(lint &a, lint b) { if (a < b) a = b; }
void chmin(lint &a, lint b) { if (a > b) a = b; }
struct IoSetup{
    IoSetup(){
      ios::sync_with_stdio(false);
      cin.tie(nullptr);
      cout << fixed << setprecision(20);
      cerr << fixed << setprecision(20);
    }
} iosetup;

int main() {
  int a, b, c, d; cin >> a >> b >> c >> d;
  if (d == 1) {
    cout << 1 << '\n';
  } else {
    cout << 0 << '\n';
  }
}


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



int main(){
  int n, m;
  cin >> n >> m;
  cout << (n-1)*(m-1) << endl;
}

Measured memory_bytes: 256
c11,c12,c13 = map(int,input().split())
c21,c22,c23 = map(int,input().split())
c31,c32,c33 = map(int,input().split())

if c12 - c11 == c22 - c21 == c32 - c31 and c13 - c12 == c23 - c22 == c33 - c32:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
A, B, C, X, Y = map(int, input().split())
if A+B <= C*2:
    print(A*X+B*Y)
if A+B > C*2:
    if X>Y:
        if A*(X-Y) > C*(X-Y)*2:
            print(C*2*X)
        else:
            print(C*2*Y + A*(X-Y))
    else:
        if B*(Y-X) > C*(Y-X)*2:
            print(C*2*Y)
        else:
            print(C*2*X + B*(Y-X))

Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        if(n == 2){
            System.out.println(1);
            return;
        }
        long ans = calc_n1(n-1);
        ans += calc_n0(n);
        System.out.println(ans);
    }
    
    public static long calc_n1(long l){
        long max = (long)Math.pow(l,0.5)+1;
        long ret = 1;
        for(long i = 2; i < max; i++){
            if(l % i == 0){
                ret += (l / i == i) ? 1 : 2;
            }
        }
        return ret;
    }
    
    public static long calc_n0(long l){
        long max = (long)Math.pow(l,0.5)+1;
        long ret = 1;
        for(long i = 2; i < max; i++){
            long l2 = l;
            boolean div = false;
            while(l2 % i == 0){
                l2 /= i;
                div = true;
            }
            if(l2 % i == 1 && div){
                ret++;
            }
        }
        return ret;
    }
}

Measured memory_bytes: 23764
#!/usr/bin/env python3
import sys
INF = float("inf")


def main():
    # bit DP
    N, M = map(int, input().split())
    a, b, c, d = [], [], [], []

    for i in range(M):
        a_, b_ = map(int, input().split())
        c_ = tuple(map(int, input().split()))
        d_ = 0
        for keta in c_:
            d_ |= 1 << keta-1
        a.append(a_)
        b.append(b_)
        c.append(c_)
        d.append(d_)

    DP = [INF]*(2**N)
    DP[0] = 0

    for i in range(M):
        DPnext = DP[:]
        for k in range(2**N):
            DPnext[k | d[i]] = min(DP[k | d[i]], DP[k]+a[i], DPnext[k | d[i]])
        DP = DPnext
    if DP[-1] == INF:
        print(-1)
    else:
        print(DP[-1])
    pass


if __name__ == '__main__':
    main()


Measured memory_bytes: 50648
#include<bits/stdc++.h>
#define rep(i,start,lim) for(lld i=start;i<lim;i++)
#define repd(i,start,lim) for(lld i=start;i>=lim;i--)
#define scan(x) scanf("%lld",&x)
#define print(x) printf("%lld ",x)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define br printf("\n")
#define sz(a) lld((a).size())
#define YES printf("Yes\n")
#define NO printf("No\n")
#define all(c) (c).begin(),(c).end()
#define INF         1011111111
#define LLINF       1000111000111000111LL
#define EPS         (double)1e-10
#define MOD         1000000007
#define PI          3.14159265358979323
using namespace std;
typedef long double ldb;
typedef long long lld;
lld powm(lld base,lld exp,lld mod=MOD) {lld ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
lld ctl(char x,char an='a') {return (lld)(x-an);}
char ltc(lld x,char an='a') {return (char)(x+an);}
#define bit(x,j) ((x>>j)&1)
typedef vector<lld> vlld;
typedef pair<lld,lld> plld;
typedef map<lld,lld> mlld;
typedef set<lld> slld;
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mxm(a,b) a = max(a,b)
#define mnm(a,b) a = min(a,b)
#define endl '\n'
#define fre freopen("1.in","r",stdin); freopen("1.out","w",stdout);
#define N 1000005
lld pr[N];
int main()
{
    //sync;
    rep(i,2,N) if(pr[i] == 0) {
        for(lld j=i*i;j<N;j+=i) pr[j] = 1;
    }
    lld n,cnt = 0;
    cin>>n;
    for(lld i=5;i<N;i+=5) if(pr[2*i-1] == 0) {
        if(cnt == n) break; 
        cout<<(2*i-1)<<endl;
        cnt++;
    }
    return 0;
}

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

int main(){
int n,c,d=0;
  cin>>n;
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin>>vec.at(i);
  }
  
  for(int i=0;i<n;i++){
    for(int j=i;j<n;j++){
      if(vec.at(i)<vec.at(j)){
        c=vec.at(i);
        vec.at(i)=vec.at(j);
        vec.at(j)=c;
      }
         }
         }
        for(int i=0;i<n;i++){
          if(i%2==0){
          d+=vec.at(i);
          }else{
            d-=vec.at(i);
          }
        }
         cout<<d;
         }
         


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

int find_ok(vector<int> v,int l){
    int left = 0;
    int right = v.size();
    while(right - left > 1){
        int middle = (left + right) / 2;
        if(l < v[middle]){
            right = middle;
        }
    }
}

int main(){
    int n;
    cin >> n;
    vector<int> L(n);
    for(int i=0;i<n;i++){
        cin >> L[i];
    }
    sort(L.begin(),L.end());
    int ans = 0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            int key = L[i] + L[j];
            int k = lower_bound(L.begin(), L.end(), key) - L.begin();
            ans += max(k-j-1,0);
        }
    }

    cout << ans << endl;


}

Measured memory_bytes: 256
/*
 _ _ _   _    _   _    _   _ _ _   _    _   _ __ _   __       __
|  _ _| | |  | | | |  | | |  _  | | |  | | |  __  | |   \   /   |
| |_ _  | |__| | | |  | | | |_| | | |__| | | |__| | | |\ \_/ /| |
|_ _  | |  __  | | |  | | |  _ <  |  __  | |  __  | | | \   / | |
 _ _| | | |  | | | |__| | | |_| | | |  | | | |  | | | |  \_/  | |  _   _   _
|_ _ _| |_|  |_| |_ __ _| |_ _ _| |_|  |_| |_|  |_| |_|       |_| |_| |_| |_|

*/

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define debug(a) cout << #a << " = " << a << " ";
#define endl "\n"
const int MOD=1e9 + 7;
const int N=1000100;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){  
                                                        for (auto &v : vec) is >> v; return is; }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;

void solve(){
    long n;
    cin>>n;
    bool ff=true;
    for(int i=0;i<n;i++){
        long x;
        cin>>x;
        if(x%2) continue;
        if(!(x%3==0 || x%5==0)){
            ff=false;
        }
    }
    if(ff){
        cout<<"APPROVED";
    } else {
        cout<<"DENIED";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long int t = 1;
    // cin>>t;
    for (long int tt = 1; tt <= t; tt++) {
        solve();
    }
    return 0;
}


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

using namespace std;

#define rep(i, a, b) for (auto i = (a); i < (b); ++i)

typedef string::const_iterator State;

int factor(State &begin);

int number(State &begin) {
  int ret = 0;
  while (isdigit(*begin)) {
    ret *= 10;
    ret += *begin - '0';
    begin++;
  }
  return ret;
}

int term(State &begin) {
  int ret1 = factor(begin);
  for (;;) {
    if (*begin == '*') {
      begin++;
      ret1 &= factor(begin);
    } else if (*begin == '+') {
      begin++;
      ret1 |= factor(begin);
    } else if (*begin == '-' && *(begin + 1) == '>') {
      begin += 2;
      int ret2 = factor(begin);
      ret1 = (ret1 == 1 && ret2 == 0 ? 0 : 1);
    } else {
      break;
    }
  }
  return ret1;
}

bool expression(State &begin) {
  int ret1 = term(begin);
  begin++;
  int ret2 = term(begin);
  return ret1 == ret2;
}

int factor(State &begin) {
  if (isdigit(*begin)) {
    return number(begin);
  } else if (*begin == '(') {
    begin++;
    int ret = term(begin);
    begin++;
    return ret;
  } else if (*begin == '-') {
    begin++;
    int ret = factor(begin);
    return 1 ^ ret;
  }
}

bool solve() {
  string s; getline(cin, s);
  if (s == "#") return false;
  vector<char> v;
  int n = (int)s.size();
  rep(i, 0, n) {
    if (s[i] == 'T') s[i] = '1';
    else if (s[i] == 'F') s[i] = '0';
  }
  string t = s;
  rep(i, 0, (1 << 11)) {
    rep(j, 0, n) {
      if ('a' <= t[j] && t[j] <= 'k') {
        t[j] = ((i & (1 << (t[j] - 'a'))) == 0 ? '0' : '1');
      }
    }
    State begin = t.begin();
    if (!expression(begin)) {
      cout << "NO" << endl;
      return true;
    }
    t = s;
  }
  cout << "YES" << endl;
  return true;
}

int main()
{
  while (solve());
}


Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, l, r, total;
  cin >> N ;
  int i=0;
  while(i<N){
    cin >> l >> r;
    total += r-l+1;
    i++;
  }
  cout << total << endl;
  return 0;
}
    


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

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 V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    while(1) {
        ll w, h, t, p;
        cin >> w >> h >> t >> p;
        if(!w) break;

        vector<vector<ll>> v(2*h, vector<ll>(2*w));
        REP(i, h) REP(j, w) v[i][j] = 1;
        // REP(i, h) cout << v[i] << endl;
        REP(i, t) {
            ll d, c;
            cin >> d >> c;
            if(d == 1) {
                REP(i, h) FOR(j, c, 2*c) {
                    v[i][j] += v[i][2*c-1-j];
                }
                REP(i, h) REP(j, 2*w-c) {
                    v[i][j] = v[i][j+c];
                }
                REP(i, h) FOR(j, 2*w-c, 2*w) {
                    v[i][j] = 0;
                }
            } else {
                REP(i, w) FOR(j, c, 2*c) {
                    v[j][i] += v[2*c-1-j][i];
                }
                REP(i, w) REP(j, 2*h-c) {
                    v[j][i] = v[j+c][i];
                }
                REP(i, w) FOR(j, 2*h-c, 2*h) {
                    v[j][i] = 0;
                }
            }

            // REP(i, h) cout << v[i] << endl;
        }

        REP(i, p) {
            ll x, y;
            cin >> x >> y;
            cout << v[y][x] << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 3128
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	long long k;
	cin>>s>>k;
	for (int i=0;i<s.size();i++){
		if (s[i]!='1') break;
		if (i==k-1){
			cout<<"1";
			return 0;
		}
	}
	for (int i=0;i<s.size();i++)
		if (s[i]!='1'){
			cout<<s[i];
			return 0;
		}
}

Measured memory_bytes: 256
n,a,b = gets.chomp.split.map(&:to_i)
MOD = 10**9 + 7

def cmb(n,k)
  res = 1
  i = k
  j = 1
  while i > 0
    res = res * (n-i+1)
    res %= MOD
    j *= i
    j %= MOD
    i -= 1
  end
  res *= inv(j)
  res %= MOD
  res
end

def pow(base,exponent)
  raise ArgumentError if exponent < 0
  # 指数が0の時は結果は1です
  return 1 if exponent==0
  # 結果が出る変数を用意
  result = 1
  # 指数が1なら終了
  while exponent != 1 do
    # 指数が奇数の時、その時の底はここでresultに掛けてしまい、指数を一つ減らす
    if exponent.odd? then
      result *= base
      exponent -= 1
    end
    # 指数を2で割る
    exponent /= 2
    # 底の2乗を新たな底とする
    base *= base
    base = base % MOD
    # 繰り返す
  end
  result *= base
  # 結果を返す
  return result
end

def inv(x)
  res = 1 # 逆元をどんどんかけるやつ
  beki = x # 逆元を計算したい値のMOD化でのべき乗
  (MOD - 2).to_s(2).reverse.chars do |digest|
    res = (beki * res) % MOD if digest == '1'
    beki = (beki * beki) % MOD
  end
  res
end

if a == b
  p (pow(2, n) - cmb(n, a) - 1) % MOD
else
  p (pow(2, n) - cmb(n, a) - cmb(n, b) - 1) % MOD
end



Measured memory_bytes: 1916
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <math.h>
using namespace std;
typedef long long int ll;

int n,m,t;
int d[210][210];
bool used[10];
int r[10];
ll ans;

void dfs(int cnt,int las,int dist){
	if(cnt==t){
		if(ans>dist)ans=dist;
		return;
	}
	for(int i=0;i<t;i++){
		if(!used[i]){
			used[i]=true;
			if(las==t)dfs(cnt+1,i,0);
			else dfs(cnt+1,i,dist+d[r[las]][r[i]]);
			used[i]=false;
		}
	}
	return;
}

int main(){
	cin >> n >> m >> t;
	for(int i=0;i<210;i++){
		for(int j=0;j<210;j++){
			if(i!=j)d[i][j]=1e9;
		}
	}
	for(int i=0;i<t;i++){
		cin >> r[i]; r[i]--;
	}
	for(int i=0;i<m;i++){
		int a,b,c;
		cin >> a >> b >> c;
		a--;b--;
		if(d[a][b]>c){
			d[a][b]=d[b][a]=c;
		}
	}
	for(int k=0;k<n;k++){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(d[i][j]>d[i][k]+d[k][j]){
					d[i][j]=d[i][k]+d[k][j];
				}
			}
		}
	}
	ans=1e9;
	dfs(0,t,0);
	cout << ans << endl;
	return 0;
}

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

const int inf = 1e9;
const ll linf = 1e18;



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

    int n; cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    
    ll res = 0, x = 0, s = 0;
    int l = 0, r = 0;
    for (; l < n; l++) {
        while (r < n && ((x ^ a[r]) == (s + a[r]))) x ^= a[r], s += a[r], r++;
        res += r - l;
        x ^= a[l], s -= a[l];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const ll INF = INT_MAX;
const int MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)

struct SegmentTree {
        private:
        int n;
        vector<int> node;
        
        public:
        SegmentTree(vector<int> v){
                int sz = (int)v.size();
                n = 1;
                while(n < sz) n *= 2;
                node.resize(2*n-1,0);
                for(int i=0;i<sz;i++) node.at(i+n-1) = v.at(i);
                for(int i=n-2;i>=0;i--) node.at(i) = node.at(2*i+1)+node.at(2*i+2);
        }
        
        //x番目の要素にvalをたす。
        void add(int x,int val){
                x += n-1;
                node.at(x) += val;
                while(x > 0){
                        x = (x-1)/2;
                        node.at(x) = node.at(2*x+1)+node.at(2*x+2);
                }
        }
        
        //区間[a,b)のwaを求める
        int getsum(int a,int b,int k=0,int l=0,int r=-1){
                if(r < 0) r = n;
                if(r <= a || b <= l) return 0;
                if(a <= l && r <= b) return node.at(k);
                int vl = getsum(a,b,2*k+1,l,(l+r)/2);
                int vr = getsum(a,b,2*k+2,(l+r)/2,r);
                return vl+vr;
        }
};

int main(){
        int n;
        cin >>n;
        string s;
        cin >> s;
        int q;
        cin >> q;
        vector<SegmentTree> seg;
        rep(i,26){
                  SegmentTree www(vector<int>(n,0));
                  seg.push_back(www);
        }
        
        rep(i,n){
                  seg.at(s.at(i) - 'a').add(i,1);
        }
        
        rep(i,q){
                int a;
                cin >> a;
                if(a == 1){
                        int b;
                        char c;
                        cin >> b >> c;
                        --b;
                        if(s.at(b) == c) continue;
                        else {
                          seg.at(c-'a').add(b,1);
                          seg.at(s.at(b)-'a').add(b,-1);
                          s.at(b) = c;
                        }
                }
                else{
                        int b,c;
                        cin >> b >> c;
                        --b;--c;
                        int ans = 0;
                        rep(k,26){
                                if(seg.at(k).getsum(b,c+1) >= 1) ans ++;
                        }
                        cout << ans <<endl;
                }
        }
        return 0;
}
   

Measured memory_bytes: 115292
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

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

#define REP(i, n) for(ll i = 0; i < n; i++)




int main() {
    string s;
    cin >> s;
    
    bool ok = true;
    if(s[0] != 'A') ok = false;
    int idx;
    for(idx = 2; idx < s.size() - 1; idx++){
        if(s[idx] == 'C')break;
    }
    if(idx == s.size() - 1) ok = false;
    for(int i = 1; i < s.size(); i++){
        if(i == idx) continue;
        if('a' > s[i] || s[i] > 'z') ok = false;
    }
    cout << (ok? "AC" : "WA") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
#include <deque>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
 
int a[10000007] = {};
int main() {
    ios::sync_with_stdio(false);
	int n;
    ll z = 0;
    cin >> n;
    for( int i = 1 ; i <= n ; i++ ) {
        for( int j = i ; j <= n ; j += i ) a[j]++;
    }
    for( int i = 1 ; i <= n ; i++ ) z += 1ll * i * a[i];
    cout << z;
}

Measured memory_bytes: 42708
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] <= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) left = mid;
		else right = mid;
	}
	/* left は条件を満たす最大の値、right は条件を満たさない最小の値になっている */
	return left;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int main() {
	int h, w;
	cin >> h >> w;
	int f;
	cin >> f;
	char dp[10][10] = {};
	int black = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			char a;
			cin >> a;
			dp[i][j] = a;
			if (a == '#') {
				black++;
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < (1 << h); i++) {
		for (int j = 0; j < (1 << w); j++) {
			int sum = 0;
			for (int k = 0; k < h; k++) {
				if (i & (1 << k)) {
					for (int l = 0; l < w; l++) {
						if (dp[k][l] == '#') {
							sum++;
						}
					}
				}
			}
			for (int k = 0; k < w; k++) {
				if (j & (1 << k)) {
					for (int l = 0; l < h; l++) {
						if (dp[l][k] == '#') {
							sum++;
						}
					}
				}
			}

			for (int k = 0; k < h; k++) {
				for (int l = 0; l < w; l++) {
					if (i & (1 << k) && j & (1 << l)) {
						//cout << 1;
						if (dp[k][l] == '#') {
							sum--;
						}
					}
				}
			}
			//cout << i << " " << j << " "<<sum<<endl;
			if (black - sum == f) {
				ans++;
			}
		}
	}
	cout << ans << endl;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
  string S; cin >> S;
  cout << "ABC" << S << endl;

  return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>

using namespace std;

/////////////         modの計算

int mod = 998244353;

long long mod_adjust(long long a) {//	余りをとる(0～mod-1に調整する)
	if (a > mod) {
		return a % mod;
	}
	if (a < 0) {
		a *= -1;
		a %= mod;
		return mod - a;
	}
	return a;
}
int mod_add(int a, int b) {//	足し算
	long long k = mod_adjust((long long)a); k += mod_adjust((long long)b);
	k = mod_adjust(k);
	return (int)k;
}
int mod_sub(int a, int b) {//	引き算
	return mod_add(a, -b);
}
int mod_multi(int a, int b) {//	掛け算
	long long k = mod_adjust((long long)a);
	k *= mod_adjust((long long)b);
	k = mod_adjust(k);
	return (int)k;
}
int mod_inv(int a) {//	逆元
	long k = (int)mod_adjust((long long)a);
	if (k == 0) { return 0; }
	if (k == 1) { return 1; }
	long long p = mod, q = k, m = 0, n = 1, r, c;

	while (q > 1) {
		r = p % q;
		c = p / q;
		c = mod_adjust(m - n * c);
		p = q, m = n, q = r, n = c;
	}
	return (int)mod_adjust(n);
}
int mod_div(int a, int b) {//	割り算
	return mod_multi(a, mod_inv(b));
}
int mod_pow(int x, int n) {//	累乗(logNオーダーなので速い)
	x = (int)mod_adjust((long long)x);
	n = n % (mod - 1);
	if (n < 0) {
		return mod_pow(mod_div(1, x), -n);
	}
	if (n == 0) {
		return 1;
	}
	if (n == 1) {
		return (int)mod_adjust((long long)x);
	}
	if (n % 2 == 0) {
		int k = mod_pow(x, n / 2);
		return mod_multi(k, k);
	}
	else {
		int k = mod_pow(x, n / 2);
		return mod_multi(mod_multi(k, k), x);
	}
}

int* factorial = NULL;			//	階乗
int* factorial_inv = NULL;		//	階乗の逆元

//	階乗を事前に計算しておく関数。
//	Nはmod_combination(n, r)で呼び出されうる最大の数。
void calc_factorial(int N) {////////////////////////// 初めに必ず呼び出すこと！！！
	N = min(mod - 1, N);
	factorial = new int[N + 1];
	factorial_inv = new int[N + 1];

	factorial[0] = 1;
	factorial_inv[0] = 1;
	for (int i = 1; i <= N; i++) {
		factorial[i] = mod_multi(factorial[i - 1], i);
		factorial_inv[i] = mod_inv(factorial[i]);
	}
}
int mod_combination(int n, int r) {//	nCr	を計算する
	if (n < 0 || r < 0 || r > n) { return 0; }
	if (n >= mod) { return 0; }
	if (r < 0) { return 0; }
	return mod_multi(factorial[n], mod_multi(factorial_inv[n - r], factorial_inv[r]));
}

int main() {
	int N, M; cin >> N >> M;
	calc_factorial(N + M * 2);//	mod_combinationを使うための事前準備

	int size = M / 2;
	int* a = new int[size + 1];// N-2+i C i
	int* b = new int[size + 1];// N * sum(a_i)
	for (int i = 0; i <= size; i++) {
		a[i] = mod_combination(N + i - 2, i);
	}
	
	for (int i = 0; i <= size; i++) {
		if (i == 0) {
			b[i] = N;
		}
		else {
			b[i] = mod_add(b[i - 1], mod_multi(a[i], N));
		}
	}

	int sum = 0;
	for (int m = 0; m * 2 <= M; m++) {
		int s = mod_combination(N, M - m * 2);// 1の配分
		int t = mod_combination(N + M + m - 1, N - 1);// M+m個の"2"を配分
		t = mod_sub(t, b[m]);// そこから、"2"の個数の最大がM個以上の場合を除く
		t = mod_add(t, mod_multi(N - M + m*2, a[m]));// でも、1が入っていないところには入れられるのでその分を増やす
		s = mod_multi(s, t);
		sum = mod_add(sum, s);
	}

	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 17792
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
using namespace std;

int main(void) {
	int n, k;
	int total = 0;
	int x[101];

	cin >> n >> k;
	FOR(i, 1, n) {
		cin >> x[i];
		if (abs(k - x[i]) > abs(x[i])) {
			total += abs(x[i])*2;
		}
		else {
			total += abs(k - x[i])*2;
		}
	}
	cout << total << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define debug(v) cout << #v<< ": " << v <<endl;
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000000007;

int main(){
    ll n; cin >> n;
    vll a(n);
    rep(i, 0, n){
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    reverse(all(a));
    ll ans = 0;
    Map m;
    vll l(0);
    rep(i, 0, n){
        if(m.find(a[i]) == m.end()){
            m[a[i]] = 1;
            l.emplace_back(a[i]);
            continue;
        }
        m[a[i]]++;
    }
    sort(l.begin(),l.end());
    reverse(all(l));
    priority_queue<ll> q;
    q.push(m[l[0]]);
    ans += l[0]*(m[l[0]] - 1);
    rep(i, 0, m[l[0]]){
        q.push(l[0]);
    }
    rep(i, 1, sz(l)){
        ll x = l[i];
        ll y = m[l[i]];
        ans += q.top();
        q.pop();
        q.push(l[i]);
        q.push(l[i]);
        rep(j, 1, y){
            ans += q.top();
            q.pop();
            q.push(l[i]);
            q.push(l[i]);
        }
    }
    prtl(ans);
}




Measured memory_bytes: 21848
#include <iostream>
#include <map>

using namespace std;

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

ll h, w, n;
P p[110000];
map<ll, ll> mp;
ll ans[10];

int main() {
  cin >> h >> w >> n;
  
  for (int i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    a--;
    b--;
    ll c = a * w + b;
    mp[c-w-1]++;
    mp[c-w]++;
    mp[c-w+1]++;
    mp[c-1]++;
    mp[c]++;
    mp[c+1]++;
    mp[c+w-1]++;
    mp[c+w]++;
    mp[c+w+1]++;
  }
  
  for (P p: mp) {
    ll c = p.first;
    ll cnt = p.second;
    ll a = c / w, b = c % w;
    if (0 < a and a < h-1 and 0 < b and b < w-1) {
      ans[cnt]++;
    }
  }
  
  ll sum = 0;
  for (int i = 1; i <= 9; i++) {
    sum += ans[i];
  }
  ans[0] = (h-2) * (w-2) - sum;
  
  for (int i = 0; i <= 9; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 56448
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,ans=0;
    cin>>n>>m;
    for(int i=1;i*i<=m;i++)
        if(m%i==0){
            int i1=i,i2=m/i;
            if(i1<=m/n && i1>ans)
                ans=i1;
            if(i2<=m/n && i2>ans)
                ans=i2;
        }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        new Program().Calc();
    }

    Scanner cin;

    public Program() { }

    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    void Calc()
    {
        cin = new Scanner();

        int n = cin.nextInt();
        string s = cin.next();

        if (n % 2 == 1)
        {
            WriteLine("No");
        }
        else
        {
            string ans = "Yes";

            char[] s_ = s.ToCharArray();

            for (int i = 0; i < n / 2; ++i)
            {
                if (s_[i] != s_[i + n / 2])
                {
                    ans = "No";
                    break;
                }
            }

            WriteLine(ans);
        }
    }
}

public static class StringExtension
{
    public static char GetChar1(this string str, int indexOneBase)
    {
        return str[indexOneBase - 1];
    }
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13140
n, l = map(int, input().split())

ans = 0
min_abs = float('inf')

for i in range(1, n + 1):
   ans += l + i - 1 
   min_abs = min(min_abs, abs(l + i - 1))

if 0 < ans:
    ans -= min_abs
else:
    ans += min_abs

print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <set>

using namespace std;

int main() {
	int N;
	int d[100];

	cin >> N;

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

	set<int> binarytree; // 二分木

	for (int i = 0; i < N; ++i) {
		binarytree.insert(d[i]);
	}

	int res = 0;
	for (int i = 1; i <= 100; ++i) {
		if (binarytree.find(i) != binarytree.end()) ++res;
	}

	cout << res << endl;

	return 0;
}

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

int main(void){

    int a;
    int b;
    int c;
    int divisor;
    
    std::cin >> a >> b >> c;
    
    for(int i = a; i <= b; i++) {
        if(c % i == 0) {
            divisor++;
        }
    }
    
    std::cout << divisor << std::endl;
    
    return 0;
}

Measured memory_bytes: 3096
#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;

int main()
{ios_base::sync_with_stdio(false);
int n,m,c[26]={0};
cin>>n>>m;
string s[1005];
rep(i,0,n-1)
{
	cin>>s[i];
	rep(j,0,m-1)c[s[i][j]-'a']++;
}

if(n%2==0)swap(m,n);

if(n%2==0&&m%2==0)
{
	int f=1;
	rep(i,0,25)if(c[i]%4)f=0;
	if(f)ol("Yes");
	else ol("No");
	return 0;
}

if(n%2==1&&m%2==0)
{
	int cnt=0;
	rep(i,0,25)
	{
		if(c[i]%2)
		{
			ol("No");
			return 0;
		}
		if(c[i]%4==2)cnt++;
	}
	if(cnt<=m/2)ol("Yes");
	else ol("No");
	return 0;
}

int cnt=0,cnt1=0;
rep(i,0,25)
{
	if(c[i]%2)cnt1++;
	if(c[i]%4==2)cnt++;
}
if(cnt1!=1)
{
	ol("No");
	return 0;
}
if(cnt<=m/2+n/2)ol("Yes");
else ol("No");
return 0;
}



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

int main(){
	int x[10010];
	int i = 0, i2, i3 = 0, a;
	cin >> a;
	while (i < a){
		cin >> x[i];
		i2 = i;
		i++;
	}
	while (i2 > i3){
		cout << x[i2] << " ";
		i2--;
	}
	cout << x[i3] << endl;
	return 0;
}

Measured memory_bytes: 3048
a=[list(map(int,input().split())) for i in range(3)]
n=int(input())
b=[int(input()) for _ in range(n)]
for i in range (3):
  for j in range(3):
    if a[i][j] in b:
      a[i][j]=0
if a[0][0]==0 and a[0][1]==0 and a[0][2]==0:
  print('Yes')
elif a[1][0]==0 and a[1][1]==0 and a[1][2]==0:
  print('Yes')
elif a[2][0]==0 and a[2][1]==0 and a[2][2]==0:
  print('Yes')
elif a[0][0]==0 and a[1][0]==0 and a[2][0]==0:
  print('Yes')
elif a[0][1]==0 and a[1][1]==0 and a[2][1]==0:
  print('Yes')
elif a[0][2]==0 and a[1][2]==0 and a[2][2]==0:
  print('Yes')
elif a[0][0]==0 and a[1][1]==0 and a[2][2]==0:
  print('Yes')
elif a[0][2]==0 and a[1][1]==0 and a[2][0]==0:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9276
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;


int main()
{
	int N;
	cin >> N;
	vector<ll>v(N);
	for (auto& i : v)cin >> i;
	vector<ll>pSum(N + 1, 0);
	pSum[0] = v[0];
	for (int i = 1; i < N; i++)pSum[i] = (pSum[i - 1] + v[i]) ;
	ll sum = 0;
	for (int i = 0; i < N - 1; i++)
	{
		sum = (sum + (v[i] * ((pSum[N - 1] - pSum[i]) % MOD)) % MOD) % MOD;
	}
	cout << sum%MOD;
}


Measured memory_bytes: 6424
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N; cin >> N;
    int count = 0;
    for (int i = 1; i < N + 1; i++) {
        int I = i, dN = 1;
        while (I / 10 != 0) {
            I /= 10;
            dN++;
        } 
        if (dN % 2 != 0) { count++; }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	var s string
	fmt.Scan(&s)

	n0 := strings.Count(s, "0")
	n1 := strings.Count(s, "1")
	fmt.Println(2 * min(n0, n1))
}


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

const int N=1024;
int a[N];

int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    int sum=0;
    for (int i=1;i<=n;i++) {
        scanf("%d",&a[i]);
        sum+=a[i];
    }
    sort(a+1,a+n+1,greater<int>());
    if (a[m]*4*m>=sum) {
        puts("Yes");
    } else {
        puts("No");
    }
    return 0;
}

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

int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
    list<int> l(1, 1);
    for (size_t i = 0; i + 1 < s.size(); i++)
    {
        if (s[i] == s[i + 1])
        {
            l.back()++;
        }
        else
        {
            l.push_back(1);
        }
    }
    while (l.size()>2)
    {
        if (l.front()<l.back())
        {
            *next(l.begin())+=l.front();
            l.pop_front();
        }
        else
        {
            *next(l.rbegin())+=l.back();
            l.pop_back();
        }
    }
    cout << max(l.front(), l.back()) << endl;

    return 0;
}


Measured memory_bytes: 1856
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Rest[] rests = new Rest[n];
		for (int i = 0; i < n; i++) {
			rests[i] = new Rest(i + 1, sc.next(), sc.nextInt());
		}
		Arrays.sort(rests, new Comparator<Rest>() {
		public int compare(Rest r1, Rest r2) {
			if (r1.s.equals(r2.s)) {
				return r2.p - r1.p;
			} else {
				return r1.s.compareTo(r2.s);
			}
		}
		});
		StringBuilder sb = new StringBuilder();
		for (Rest r : rests) {
			sb.append(r.idx).append("\n");
		}
		System.out.print(sb);
	}
	
	static class Rest {
		int idx;
		String s;
		int p;
		public Rest(int idx, String s, int p) {
			this.idx = idx;
			this.s = s;
			this.p = p;
		}
		
		public String toString() {
			return s + " " + p;
		}
	}
}


Measured memory_bytes: 21844
n,a,b,c=map(int,input().split())
bam=[]
for i in range(n):
  bam.append(int(input()))
def base10toN(num, base):
    converted_string, modstring = "", ""
    currentnum = num
    if not num:
        return '0'
    while currentnum:
        mod = currentnum % base
        currentnum = currentnum // base
        converted_string = chr(48 + mod + 7*(mod > 10)) + converted_string
    return converted_string
ans=10**18
for i in range(4**n):
  s=base10toN(i, 4)
  slist=[]
  for i in range(len(s)):
    slist.append(s[i])
  slist.reverse()
  for i in range(n-len(s)):
    slist.append('0')
  slist.reverse()
  s1=[]
  s2=[]
  s3=[]
  for i in range(n):
    if slist[i]=='1':
      s1.append(bam[i])
    if slist[i]=='2':
      s2.append(bam[i])
    if slist[i]=='3':
      s3.append(bam[i])
  if len(s1)==0 or len(s2)==0 or len(s3)==0:
    continue
  anscan=abs(sum(s1)-a)+abs(sum(s2)-b)+abs(sum(s3)-c)+10*(len(s1)-1)+10*(len(s2)-1)+10*(len(s3)-1)
  ans=min(ans,anscan)
print(ans)

Measured memory_bytes: 75988
def LI():
  return [int(s) for s in input().split()]

N = int(input())
W = LI()

S1 = W[0]
S2 = sum(W[1:])

min_sum = abs(S1-S2)

for i in range(1,N):
  S1+=W[i]
  S2-=W[i]
  if min_sum > abs(S1-S2):
    min_sum = abs(S1-S2)
    
print(min_sum)
  

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000



int main(){
	
	int A,B;
	cin>>A>>B;
	
	for(int i=1;i<=100000;i++){
		int a = i*8/100;
		int b = i*10/100;
		
		if(A==a&&B==b){
			cout<<i<<endl;
			return 0;
		}
	}
	
	cout<<-1<<endl;
	
    return 0;
}



Measured memory_bytes: 256
//嘘っぽいのに通ってたやつでいこう

#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

char cn[2000100], *ci = cn, c;

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


	fread(cn, 1, 2000100, stdin);
	int N = 0;
	while ((c = *ci++) >= '0') N = N * 10 + c - '0';
	int sL[1001] = {}, sR[1001] = {};
	pair<int, int> RR[500], LL[500];
	int rr = 0, ll = 0;
	int tot = 0;
	rep(i, N) {
		int l = 0, r = 0;
		while ((c = *ci++) >= '(') {
			if (c == '(') r++;
			else {
				if (r > 0) r--;
				else l++;
			}
		}
		tot += r - l;
		if (l < r) {
			if (l <= 1000) sR[l] += r;
			else RR[rr++] = { l,r };
		}
		else {
			if (r <= 1000) sL[r] += l;
			else LL[ll++] = { r,l };
		}
	}

	if (tot != 0) {
		printf("No");
		return 0;
	}

	sort(RR, RR + rr);
	sort(LL, LL + ll);

	int OK = 1;
	int k = 0;
	rep(i, 1001) {
		if (sR[i]) {
			if (k < i) OK = 0;
			k += sR[i];
		}
	}
	rep(i, rr) {
		if (k < RR[i].first) OK = 0;
		k += RR[i].second - RR[i].first;
	}
	k = 0;
	rep(i, 1001) {
		if (sL[i]) {
			if (k < i) OK = 0;
			k += sL[i];
		}
	}
	rep(i, ll) {
		if (k < LL[i].first) {
			OK = 0;
		}
		k += LL[i].second - LL[i].first;
	}

	if (OK) printf("Yes");
	else printf("No");

	Would you please return 0;
}


Measured memory_bytes: 3524
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	int64_t n, d; cin >> n >> d;
	d *= d;
	int ans = 0;
	rep(i,n) {
		int64_t x, y; cin >> x >> y;
		int64_t s = x * x + y * y;
		if(s <= d) ++ans;
	}
	cout << ans << '\n';
	return 0;
}

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

int main(){
  cout<<fixed<<setprecision(12);
  double r;
  cin>>r;

  double pi=acos(-1);
  double area=r*r*pi;
  double cir=2*r*pi;
  cout<<area<<" "<<cir<<endl;
  return 0;
}




Measured memory_bytes: 3296
#include <bits/stdc++.h>
using namespace std;
 //Compiler version g++ 6.3.0

 int main()
 {
 	int N,t;
 	vector<int>a;
 	cin >> N >> t;
 	for (int i = 0; i < N; i++) {
 		int x,y;
 		cin >> x>>y;
 		if(y<=t){
 			a.push_back(x);
 		}
 		}
 	sort(a.begin(), a.end());
 	if(!a.empty()){
 	cout << a.at(0) << endl;
 	}else{
 		cout << "TLE" << endl;
 	}
 }

Measured memory_bytes: 256