akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;
int main()
{
    char s[200005]={0};
    char t[200005]={0};
    scanf("%s",s);
    scanf("%s",t);
    int len=strlen(s);
    int cnt=0;
    for(int i=0;i<len;i++)
        if(s[i]!=t[i])cnt++;
    printf("%d",cnt);
    return 0;
}


Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=505,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S,T;cin>>S;
    T=S;
    reverse(all(T));
    
    for(int i=0;i<si(T);i++){
        if(T[i]=='b') T[i]='d';
        else if(T[i]=='d') T[i]='b';
        else if(T[i]=='p') T[i]='q';
        else T[i]='p';
    }
    
    if(S==T) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



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

ans = 0
s = 0 # 区間和
x = 0 # 区間排他的論理和?

r = 0
for l in range(n):
    while r < n and s+a[r] == x^a[r]:
        s += a[r]
        x ^= a[r]
        r += 1

    ans += (r-l) # 条件を満たす部分列の長さだけ ans を加算

    if l == r:
        r += 1

    else:
        s -= a[l]
        x ^= a[l]

print(ans)

Measured memory_bytes: 23560
n=int(input())
a=[0,0,0,0]
b=['AC','WA','TLE','RE']
for i in range(n):
    s=input()
    a[b.index(s)]+=1
print('AC x '+str(a[0]))
print('WA x '+str(a[1]))
print('TLE x '+str(a[2]))
print('RE x '+str(a[3]))

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

long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }

long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}

int main(){
	while(1){
		ll n,m; cin >> n >> m;
		if(n==0&&m==0)break;
		vector<ll>a(m);
		for(int i=0;i<m;i++){
			cin >> a[i];
		}
		double ans=0;
		ll sum=(1+n)*n/2;
		ll cnt=n;
		for(int i=1;i<(1<<m);i++){
			int bit_count=0;
			ll lc=1;
			for(int j=0;j<m;j++){
				if(i&(1<<j)){
					bit_count++;
					lc=LCM(lc,a[j]);
				}
			}
			if(bit_count%2==1){
				sum-=(n/lc+1)*(n/lc)/2*lc;
				cnt-=n/lc;
			}
			else{
				sum+=(n/lc+1)*(n/lc)/2*lc;
				cnt+=n/lc;
			}
		}
		if(cnt==0){
			cout << 0 << endl;
		}
		else{
			ans=(double)sum/cnt;
			printf("%.8f\n",ans );
		}
	}
}


Measured memory_bytes: 3196
#include <cstdio>

#define M_PI 3.14159265358979323846

int
main(void)
{
  double r;

  std::scanf("%lf", &r);
  // r = 2;

  std::printf("%lf %lf\n", r * r * M_PI, 2 * r * M_PI);
  return 0;
}



Measured memory_bytes: 2748
#include <bits/stdc++.h>
using namespace std;
int main(){
    int m,f,r;
    while(true){
        scanf("%d%d%d",&m, &f, &r);
        if(m==-1 && f==-1 && r==-1)break;
        if(m==-1 || f==-1 || m+f<30)cout<<'F'<<endl;
        else if(m+f>=80) cout<<'A'<<endl;
        else if(m+f>=65) cout<<'B'<<endl;
        else if(m+f>=50) cout<<'C'<< endl;
        else if(m+f>=30) 
        {
            if(r>=50)cout<<'C'<<endl;
            else cout<<'D'<<endl;
        }
    }
}


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


int main()
{
	char a, b; cin >> a >> b;
	if (a <= b)
		for (int i = 0; i < b - 48; ++i)
			cout << a;
	else
		for (int i = 0; i < a - 48; ++i)
			cout << b;
	cout << endl;
}



Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define ll long long
struct apple{
    int color;  //0 is X  1 is Y  2  is  ALL
    ll value;
};
apple t[333333];
bool cmp(apple a,apple b){
    return a.value>b.value;
}
int main(){
    int n,b,i,j,k,x,y,z,s0,s1,s2;
    cin>>x>>y>>s0>>s1>>s2;
    for(i=0;i<s0;i++){
        cin>>t[i].value;
        t[i].color=0;
    }
    for(;i<s0+s1;i++){
        cin>>t[i].value;
        t[i].color=1;
    }
    for(;i<s0+s1+s2;i++){
        cin>>t[i].value;
        t[i].color=2;
    }
    sort(t,t+s0+s1+s2,cmp);
    ll c3=0,c1=0,c2=0,res=0;
    for(i=0;i<s0+s1+s2;i++){
        if(c1+c2+c3==x+y)break;
        if(t[i].color==0){
            if(c1==x)continue;
            c1++;
            res+=t[i].value;
        }
        if(t[i].color==1){
            if(c2==y)continue;
            c2++;
            res+=t[i].value;
        }
        if(t[i].color==2){
            c3++;
            res+=t[i].value;
        }
    }
    cout<<res;
}


Measured memory_bytes: 4992
use std::io::*;
use std::str::FromStr;


fn abc(r: i32) -> String {
    if r < 1200 {
        return "ABC".to_string()
    } else if r < 2800 {
        return "ARC".to_string()
    } else {
        return "AGC".to_string()
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    /*
    assert_eq!(abc(), "Yes");
    assert_eq!(abc(101), "No");
    assert_eq!(abc(999999999), "Yes");
    */
    let r: i32 = read();

    let result = abc(r);
    
    println!("{}", result);
    
}



Measured memory_bytes: 4352
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;

alias Ope = Tuple!(int, "y1", int, "x1", int, "y2", int, "x2");

void main() {
    int H, W;
    scan(H, W);
    auto a = iota(H).map!(i => readln.split.to!(int[])).array;

    Ope[] ans;

    foreach (i ; 0 .. H) {
        if (i % 2 == 0) {
            foreach (j ; 0 .. W - 1) {
                if (a[i][j] & 1) {
                    ans ~= Ope(i, j, i, j + 1);
                    a[i][j + 1]++;
                }
            }

            if ((a[i][W - 1] & 1) && i + 1 < H) {
                ans ~= Ope(i, W - 1, i + 1, W - 1);
                a[i + 1][W - 1]++;
            }
        }
        else {
            foreach_reverse (j ; 1 .. W) {
                if (a[i][j] & 1) {
                    ans ~= Ope(i, j, i, j - 1);
                    a[i][j - 1]++;
                }
            }
            if ((a[i][0] & 1) && i + 1 < H) {
                ans ~= Ope(i, 0, i + 1, 0);
                a[i + 1][0]++;
            }
        }
    }

    writeln(ans.length);
    ans.each!(ansi => writefln("%s %s %s %s", ansi.y1 + 1, ansi.x1 + 1, ansi.y2 + 1, ansi.x2 + 1));
}





void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


Measured memory_bytes: 10748
#include <iostream>

using namespace std;

int getday(int y, int m, int d)
{
    if (m <= 2) {
        --y;
        m += 12;
    }

    int dy = 365 * (y - 1);
    int c = y / 100;
    int dl = (y >> 2) - c + (c >> 2);
    int dm = (m * 979 - 1033) >> 5;
    return dy + dl + dm + d - 1;   

}

int main()
{
    int y1, m1, d1, y2, m2, d2;

    while (cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2) {
        if (y1 == -1 && m1 == -1 && d1 == -1 &&
            y2 == -1 && m2 == -1 && d2 == -1)
            break;

        cout << getday(y2, m2, d2) - getday(y1, m1, d1) << endl;
    }

    return 0;
}

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

typedef long long ll;

int main(){
  int a,b,c;
  cin >> a;
  cin >> b;
  cin >> c;
  int X;
  cin >> X;
  
  int x,y,z;
  int count = 0;
  for(int i = 0; 500*i <= X && i <= a; i++){
    for(int j = 0; 500*i + 100*j <= X && j <= b; j++){
      int k = X - 500 * i - 100 * j;
      if( k % 50 == 0 && k / 50 <= c){
        count++;
      }
    }
  }
  cout << count << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;

//少数点表示
//cout <<std::fixed << std::setprecision(14)

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

    string s;
    int n;
    cin >> n;
    cin >> s;
    rep(i,s.size()){
        if(s[i]+n<='Z'){
            s[i]+=n;
        }else{
            s[i]=64+s[i]+n-'Z';
        }
    }
    cout << s;

    //cout << 'A'+0<<" "<<'Z'+0;

}

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

using namespace std;

const long double pi = M_PI;
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> g(n);
  
  rep(i, m){
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  
  vector<int> sign(n, -1);
  vector<int> dist(n, -1);
  queue<int> que;
  dist[0] = 0;
  que.push(0);
  
  while(!que.empty()){
    int v = que.front();
    que.pop();
    
    for(int nv : g[v]){
      if(dist[nv] != -1) continue;
      dist[nv] = dist[v] + 1;
      que.push(nv);
      if(sign[nv] == -1) sign[nv] = v + 1;
    }
  } 
  cout << "Yes" << endl;
  for(int i = 1; i < n; i++){
    cout << sign[i] << endl;
  }
}

Measured memory_bytes: 10560
#include<bits/stdc++.h>
using namespace std;
#define int  long long int
#define fi first
#define se second
#define pb push_back
#define soo(v) sort(v.rbegin(),v.rend())
#define so(v) sort(v.begin(),v.end())
#define lb(v,x) lower_bound(v.begin(),v.end(),x)
#define ub(v,x) upper_bound(v.begin(),v.end(),x)
//#define endl '\n'
#define dbv(v) cout<<endl;cout<<#v<<"-->> ";for(auto it:v){cout<<it<<" ";}cout<<endl;
#define dbm(m)cout<<endl;cout<<#m<<"-->> ";for(auto it:m){cout<<it.fi<<" "<<it.se<<endl;}
#define dbs(s)cout<<endl;cout<<#s<<"-->> ";for(auto it:s){cout<<it<<" ";}cout<<endl;
#define mod 1000000007
#define db1(x) cout<<#x<<"="<<x<<endl;
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl;
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<endl;
#define mx 1e18
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v)  *min_element(v.begin(),v.end())
#define double long double
#define io std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

int32_t main()
{
    io
    float d,t,s;
    cin>>d>>t>>s;
    if(d/s<=t)
    {
      cout<<"Yes"<<endl;
    }
    else
    {
      cout<<"No"<<endl;
    }

    
}

Measured memory_bytes: 3708
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define zoom ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define precise cout.precision(8); cout << fixed;
#define seed srand(chrono::steady_clock::now().time_since_epoch().count());
const double PI = acos(-1);
using namespace std;

int main() {

    zoom;    
    string N; cin >> N;
    for(int i = 0; i < 3; i += 1) {
        if(N[i] == '7') {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}

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

typedef ostringstream OSS;
typedef istringstream ISS;

typedef long long LL;
typedef pair<int, int> PII;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<double> VD;
typedef vector<VD> VVD;
typedef vector<string> VS;
typedef vector<VS> VVS;
typedef vector<bool> VB;
typedef vector<VB> VVB;
typedef vector<PII> VPII;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x) (x).begin(),(x).end()
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a) { OSS oss; oss << a; return oss.str(); };

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

constexpr int W = 5;
int H;
VVI ts;

int score;

bool can_remove(int y, int x0) {
    int c = ts[y][x0];
    if (c == 0) return false;

    int cnt = 0;

    for (int x = x0; x < W; x++) {
        if (ts[y][x] != c) break;
        ++cnt;
    }

    return cnt >= 3;
}

void remove_ts(int y, int x0) {
    int c = ts[y][x0];

    for (int x = x0; x < W; x++) {
        if (ts[y][x] == c) {
            score += ts[y][x];
            ts[y][x] = 0;
        } else {
            return;
        }
    }
}

void fall_down() {
    for (int y = H - 1; y >= 0; --y) {
        for (int x = 0; x < W; x++) {
            for (int y2 = y + 1; y2 < H; y2++) {
                if (ts[y2][x] == 0) {
                    ts[y2][x] = ts[y2 - 1][x];
                    ts[y2 - 1][x] = 0;
                }
            }
        }
    }
}

bool remove_all_ts() {
    bool removed = false;

    for (int y = 0; y < H; y++) {
        for (int x = 0; x < W; x++) {
            if (can_remove(y, x)) {
                remove_ts(y, x);
                removed = true;
            }
        }
    }

    return removed;
}

void dump() {
    for (int y = 0; y < H; y++) {
        for (int x = 0; x < W; x++) {
            cout << ts[y][x] << " ";
        }
        cout << endl;
    }
}

int solve() {
    score = 0;

    while (remove_all_ts()) {
        fall_down();
    }

    return score;
}

int main(void) {
    while (cin >> H, H) {
        ts.clear();
        ts.resize(H, VI(W));

        for (int y = 0; y < H; y++) {
            for (int x = 0; x < W; x++) {
                cin >> ts[y][x];
            }
        }

        cout << solve() << endl;
    }

	return 0;
}

Measured memory_bytes: 1212
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

int main()
{
    int n;
    scanf("%d",&n);
    if(n<1200)
        printf("ABC\n");
    else if(n<2800&&n>=1200)
        printf("ARC\n");
    else
        printf("AGC\n");
    return 0;
}


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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Mll = M<ll, ll>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin(),ie=(c).rend();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n;

int main() {
    cin >> n;
    Vi p(n);
    REP(i, n) cin >> p[i];

    int cnt = 0;
    REP(i, n) {
        if (p[i] == i+1) {
            cnt++;
            swap(p[i], p[i+1]);
        }
    }
    cout << cnt << '\n';

    return 0;
}


Measured memory_bytes: 640
/*Arnab's Code
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define vll vector<ll>
#define vii vector<int>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define take(a,n) for(ll i=0;i<n;i++)cin>>a[i]
#define takes(a,n,st) for(ll i=st;i<n+st;i++)cin>>a[i]
ll sum(ll a[],ll n,ll s){ for(ll i=0;i<n;i++)s+=a[i]; return s;}
#define mod 1000000009
ll power(ll x, ll y, ll p)  {  
    ll res = 1;  
    x = x % p;   
    if (x == 0) return 0;  
    while (y > 0){  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1;
        x = (x*x) % p;  
    }  
    return res;  
}
ll cur,shol;
void ball(ll valt){
	ll x=cur/valt;
	shol+=x;
	cur-=(x*valt);
}
void sall(ll valt){
	ll x=shol*valt;
	shol=0;
	cur+=x;
}
ll a[97];
void solve(){
	ll n,i;
	cin>>n;
	take(a,n);
	a[n]=-1;
	cur=1000;
	shol=0;
	for(i=0;i<n;i++){
		if(a[i]>a[i+1])
			sall(a[i]);
		else
			ball(a[i]);
	}
	cout<<cur;
	return;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	ll t,T;
//	cin>>T;
	T=1;
	for(t=1;t<=T;t++){
//		cout<<"Case #"<<t<<": ";
		solve();
	}
	return 0;
}

Measured memory_bytes: 3612
#include <cstdio>
#include <cassert>
#include <utility>
#include <vector>

int testcase_ends() {
  size_t n;
  int p;
  scanf("%zu %d", &n, &p);
  if (n == 0 && p == 0) return 1;

  int p0 = p;
  std::vector<int> temoto(n);
  for (size_t i = 0; i <= 1000000; ++i) {
    size_t j = i % n;
    if (p == 0) {
      std::swap(p, temoto[j]);
    } else {
      --p;
      ++temoto[j];
      if (temoto[j] == p0) return !printf("%zu\n", j);
    }
  }
  assert(false);
}

int main() {
  while (!testcase_ends()) {}
}



Measured memory_bytes: 2680
#include <bits/stdc++.h>
using namespace std;  
typedef long long ll;
typedef vector<ll> vint;
int main() {
  ll N;
  cin >> N;
  
  ll ans;
  for (ll i=0;i<8;i++) {
    if (pow(2,i)>N) {
      ans = i-1;
      break;
    }
  }
  
  cout << pow(2,ans);
}

Measured memory_bytes: 384
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

# 多分全探索
# Cを全探索
N = getN()

# 素因数分解する

# A = iの時？
# N - cは1 ~ N - 1まで
# この中でA * Bはいくつある？

# Aが1の時

cnt = 0
for n in range(1, N):
    cnt += (N - 1) // n
print(cnt)

Measured memory_bytes: 78100
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int n;
    cin >> n;
    vl a(n), b(n);
    vector<pll> ab;
    ll as = 0;
    ll bs = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
        as += a[i];
        bs += b[i];
        ab.emplace_back(a[i], i);
        ab.emplace_back(b[i], i);
    }
    sort(ab.begin(), ab.end());
    ll ret  = min(as, bs);
    ll temp = 0;
    map<int, int> cnt;
    for (int i = 0; i < n; ++i) {
        temp += ab[i].first;
        cnt[ab[i].second]++;
    }
    int ok = false;
    for (auto &p : cnt) {
        if (p.second == 2) {
            ok = true;
            break;
        }
    }
    if (ok) {
        chmin(ret, temp);
        cout << ret << "\n";
    } else {
        for (int i = 0; i < n; ++i) {
            ll tt = temp;
            tt -= min(a[i], b[i]);
            if (ab[n].second == i)
                tt += ab[n + 1].first;
            else
                tt += ab[n].first;
            chmin(ret, tt);
        }
        cout << ret << "\n";
    }
    return 0;
}

Measured memory_bytes: 10348
# ABC086-C
read
while read t1 x1 y1; do
    (( d = (t1 - t2) - (x1 > x2 ? x1 - x2 : x2 - x1) - (y1 > y2 ? y1 - y2 : y2 - y1),
       d < 0 || d % 2 )) && echo No && exit
    read t2 x2 y2 || break
    (( d = (t2 - t1) - (x1 > x2 ? x1 - x2 : x2 - x1) - (y1 > y2 ? y1 - y2 : y2 - y1),
       d < 0 || d % 2 )) && echo No && exit
done < <(tail -n 75000)
echo Yes


Measured memory_bytes: 692
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,WW,v[110],w[110],W[110][100010];
  //W[i][j]=i番目までの荷物を使い価値j以上となるように入れるときの重さ合計の最小
  //W[N][j]がW以下となるようなjの最大値を求める
  cin >> N >> WW;
  for(int i=1; i<=N; i++){
    cin >> w[i] >> v[i];
  }

  //初期条件
  W[0][0]=0;
  for(int i=1; i<=100009; i++){
    W[0][i] = 1000000010;
  }

  for(int i=1; i<=N; i++){
    for(int j=0; j<=100009; j++){
      W[i][j]=min(W[i-1][j],W[i-1][max(0,j-v[i])]+w[i]);
    }
  }
  /*for(int i=1; i<=N; i++){
    for(int j=0; j<=30; j++){
      cout << W[i][j] << " ";
      if(j==30)cout << endl;
    }
  }*/
  int ma=0;
  for(int i=0; i<=100009; i++){
    if(W[N][i]<=WW){
      ma = i;
    }
  }
  cout << ma << endl;
}  

Measured memory_bytes: 41344
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main()
{
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    for(int i=0;i<k;i++)
    {
        if(a>=b)
        {
            b*=2;
        }
        else if(b>=c)
        {
            c*=2;
        }
    }
    if(a<b && b<c)cout<<"Yes\n";
    else cout<<"No\n";

    return 0;
}


Measured memory_bytes: 3568
N, W = map(int, input().split())
wv = [[int(_) for _ in input().split()] for _ in range(N)]
dp = [[0]*(W+1) for _ in range(N+1)]

for i in range(1, N+1):
    weight = wv[i-1][0]
    value = wv[i-1][1]
    for j in range(1, W+1):
        if j < weight:
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-weight] + value)

print(dp[N][W])

Measured memory_bytes: 119916
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = 2e9;
ll mpow(ll a, ll b){ll r=1;a%=mod;while(b){r=r*((b%2)?a:1)%mod,a=a*a%mod,b>>=1;}return r;}


int main() {
	string s,t; cin>>s;
	int n=s.size();
	vector<int> a(n+1,0),b(n+1,0);
	rrep(i,n-1,-1){
		a[i]=a[i+1]|(1<<(s[i]-'a'));
		b[i]=b[i+1];
		while(a[i]&(1<<b[i]))b[i]++;
		if(b[i]>=26) a[i]=0,b[i]=0;
	}
	rep(i,0,n){
		t+=(char)(b[i]+'a');
		while((i<n)&&(s[i]!=*t.rbegin()))i++;
	}
	cout<<t<<endl;
	return 0;
}

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

int D=365,c[26+1],last[26+1],M;

int main(){
    cin>>D;
    //input
    for(int i=1;i<=26;i++)cin>>c[i];
    int s[D+1][26+1];
    for(int i=1;i<=D;i++)for(int j=1;j<=26;j++)cin>>s[i][j];

    int t[D+1];
    for(int day=1;day<=D;day++){
        //greedy
        int max_type=0,max=-1000000000;
        for(int type=1;type<=26;type++){
            int score=s[day][type];
            for(int i=1;i<=26;i++)score-=c[i]*(day-(i==type?day:last[i]));
            if(score>max){max=score;max_type=type;}
        }
        t[day]=max_type;
        last[max_type]=day;
    }
    //output
    for(int i=1;i<=D;i++)cout<<t[i]<<endl;
    return 0;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
#define PI 3.14159265
#define seive_len 1000001

typedef long long int lli;

bool seive[seive_len];
const int MOD = 1000000007;
lli primeSeive[seive_len];

lli gcd(lli a, lli b) {
  if(b == 0)
    return a;
  return gcd(b, a%b);
}

lli lcm(lli a, lli b) {
  lli gcd_ = gcd(a, b);
  lli lcm_ = (a*b)/gcd_;
  return lcm_;
}

lli ncr(lli n, lli r) {
  lli res = 1;
  if(r > n-r)
    r = n-r;
  
  for(lli i=0;i<r;i++) {
    res *= (n-i);
    res /= (i+1);
  }
  return res;
}

lli ncrMODp(lli n, lli r) {
  if(r > n-r)
    r = n-r;
  lli prow[r+1];
  memset(prow, 0, sizeof(prow));
  prow[0] = 1;
  for(lli i=1;i<=n;i++) {
    for(lli j=min(i, r);j>0;j--) {
      prow[j] = (prow[j]+prow[j-1])%MOD;
    }
  }
  return prow[r];
}

lli fastPower(lli a, lli b) {
  lli res=1;
  while(b > 0) {
    if(b&1)
      res *= a;
    a *= a;
    b >>= 1;
  }
  return res;
}

lli fastPowerMODp(lli a, lli b) {
  a %= MOD;
  lli res = 1;
  while(b) {
    if(b%2 == 1)
      res = (res*a)%MOD;
    a = (a*a)%MOD;
    b >>= 1;
  }
  return res;
}

void multiply(lli a[][2], lli b[][2]) {
  lli res[2][2];
  memset(res, 0, sizeof(res));
  for(lli i=0;i<2;i++) {
    for(lli j=0;j<2;j++) {
      for(lli k=0;k<2;k++) {
        res[i][j] += a[i][k]*b[k][j]%MOD;
      }
    }
  }
  for(lli i=0;i<2;i++)
    for(lli j=0;j<2;j++)
      a[i][j] = res[i][j];
}

void matrixExpo(lli a[][2], lli n) {
  if(n == 0 || n == 1)
    return;
  lli b[][2] = {{1,1}, {1,0}};
  matrixExpo(a, n/2);
  multiply(a, a);
  if(n%2)
    multiply(a, b);
}

void makeSeive() {
  for(lli i=2;i*i<=seive_len;i++) {
    if(seive[i]) {
      for(lli j=i*i;j<=seive_len;j+=i)
        seive[j] = false;
    }
  }
}

void makePrimeSeive() {
  for(lli i=1;i<seive_len;i++)
    primeSeive[i] = i;
  for(lli i=4;i<seive_len;i+=2)
    primeSeive[i] = 2;
  for(lli i=3;i*i<seive_len;i++) {
    if(primeSeive[i] == i) {
      for(lli j=i*i;j<seive_len;j+=i) {
        if(primeSeive[j] == j)
          primeSeive[j] = i;
      }
    }
  }
}

bool isPrime(lli n) {
  for(lli i=2;i<=sqrt(n);i++) {
    if(n%i == 0)
      return false;
  }
  return true;
}

void getInput(vector<lli>& a, lli n) {
  lli x;
  for(lli i=0;i<n;i++) {
    cin >> x;
    a.push_back(x);
  }
}

void testCase() {
  lli i, a, b, n, count = 0;
  cin >> n;
  bool yes = false;
  for(i=0;i<n;i++) {
    cin >> a >> b;
    if(a == b)
      count++;
    else{ 
      count = 0;
    }
    if(count == 3) {
      yes = true;
    }
  }
  if(yes)
    cout << "Yes";
  else
    cout << "No";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
	lli t=1;
	// cin >> t;
  // makePrimeSeive();
  // FILE* fp;
  // fp = fopen("out.txt", "w");
	for(lli i=1;i<=t;i++) {
    // fprintf(fp, "Case #%d:\n", i);
    // cout << "Case #" << i << ":" << ' ';
		testCase();
    cout << '\n';
	}
	return 0;
}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define forr(i,n,a) for(ll i=n-1;i>=a;i--)
#define scan(arr,a,n) for(ll i=(a);i<(n);i++)cin>>(arr)[i];
#define print(arr,a,n) for(ll i=(a);i<(n);i++)cout<<(arr)[i]<<" ";

const ll inf = 1e18;

ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);}
ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, mod - 2);}


int main(){
	fast;
    #ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
    #endif
	ll n;
	cin>>n;
	ll a[n], ans = 0;
	scan(a, 0, n);
	forn(i, 0, n-2){
		forn(j, i+1, n-1){
			forn(k, j+1, n){
				if(a[i]!=a[j] && a[j]!=a[k] && a[i]!=a[k]){
					if(a[i]+a[j]>a[k] && a[i]+a[k]>a[j] && a[j]+a[k]>a[i]){
						ans++;
					}
				}
			}
		}
	}
	cout<<ans<<endl;
}

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

using namespace std;

int n, a;

int main(void)
{
	scanf("%d %d", &n, &a);
	
	if(n % a == 0)
	{
		printf("%d", n / a);
		return 0;
	}
	
	printf("%d", n / a + 1);
	return 0;
}

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

#include <algorithm>

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef long long ll;

const int MOD = 1000000007;
const int INF = 1000000007;
const ll INFLL = 1000000000000000007LL;

bool check(string s) {
  string head = s.substr(0, s.size() / 2);
  string tail = s.substr(1 + (s.size() / 2), s.size() / 2);
  return head == tail;
}

void solve() {
  string S;
  cin >> S;
  string ans = "No";
  if (check(S)) {
    ans = "Yes";
  }
  cout << ans << endl;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int n, k;
	scanf("%d%d", &n, &k);
	int arr[n];
	for(int i = 0; i < n; i++){
		scanf("%d", &arr[i]);
	}
	for(int i = 0; i < n - k; i++){
		if(arr[i] < arr[i + k]){
			puts("Yes");
		}
		else{
			puts("No");
		}
	}
	return 0;
}

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

int main()
{
    int a, b;
    cin >> a >> b;
    if (a < b)
        cout << "a < b" << endl;
    else if (a > b)
        cout << "a > b" << endl;
    else
        cout << "a == b" << endl;
}


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


int main(){
    int n;
    cin >> n;
    bool check = false;
    rep(i, 9){
        rep(j, 9){
            if (i * j == n) check = true;
        }
    }
    if (check) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define MAX 1e9
 
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
const ld pi=acos(-1);


int main(){
    IOS;
   ll x,y;
   cin>>x>>y;
   if(y%2==0 && y/2-x>=0 && -y/2+2*x>=0)cout<<"Yes";
   else cout<<"No";
    return 0;  
} 





Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            var tmp = Console.ReadLine().Split(' ');
            var a = long.Parse(tmp[0]);
            var b = long.Parse(tmp[1]);

            var xor = XorRange(a, b);
            Console.WriteLine(xor);
            //var nomal = XorOld(a, b);
            //Console.WriteLine(nomal);

            //Console.WriteLine(Convert.ToString(xor, 2));
            //Console.WriteLine(Convert.ToString(nomal, 2));
        }

        /// <summary>普通に解く</summary>
        static long XorOld(long a, long b)
        {
            var ret = 0L;
            for (var i = a; i <= b; i++)
            {
                ret ^= i;
            }
            return ret;
        }

        static long XorRange(long a, long b)
        {
            var ret = 0L;
            var aPlus = a + (4 - (a % 4));            
            var nowA = a;
            while (nowA < aPlus)
            {
                ret ^= nowA;
                nowA++;
            }
            var bMinus = b - (b % 4);
            var nowB = bMinus;
            while(nowB <= b)
            {
                ret ^= nowB;
                nowB++;
            }   


            return ret;
        }


    }
}


Measured memory_bytes: 11092
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

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

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

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

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()

	N := readInt()
	var ans int64
	for i := 0; i < N; i++ {
		l := readInt()
		r := readInt()
		ans += int64(r - l + 1)
	}
	println(ans)
}


Measured memory_bytes: 640
package main

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

var sc *bufio.Scanner

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func answer(reader io.Reader, writer io.Writer) {
	sc = bufio.NewScanner(reader)
	sc.Split(bufio.ScanWords)
	a := nextInt()
	b := nextInt()
	var c int
	if a > b {
		c = a
		a--
	} else {
		c = b
		b--
	}
	if a > b {
		c += a
		a--
	} else {
		c += b
		b--
	}
	_, _ = fmt.Fprintf(writer, "%d", c)
}

func main() {
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 640
#include <stdio.h>

int main(void)
{
  int n,i,j,ch;
  int card[4][13];
  char zu;
  int	nu;
  
  for(i=0; i<4; i++){
    for(j=0; j<13; j++)
      card[i][j]=0;
  }

  scanf("%d",&n);

  for(i=0;	i<n;	i++){
    scanf("%s%d",&zu,&nu);
    if(zu == 'S')
      ch = 0;
    else	if(zu == 'H')
      ch = 1;
    else	if(zu == 'C')
      ch = 2;
    else
      ch = 3;
    card[ch][nu-1] = 1;
  }

  for(i=0;	i<4;	i++){
    for(j=0;	j<13;	j++){
      if(card[i][j] == 0){
	if(i == 0)
	  printf("S %d\n",j+1);
	else	if(i == 1)
	  printf("H %d\n",j+1);
	else	if(i == 2)
	  printf("C %d\n",j+1);
	else
	  printf("D %d\n",j+1);
      }
    }
  }	
	return(0);
}

Measured memory_bytes: 1024
n=int(input())
a=[input() for i in range(n)]
ans=[0]*4
for i in range(n):
  if a[i]=="AC":
    ans[0]+=1
  elif a[i]=="WA":
    ans[1]+=1
  elif a[i]=="TLE":
    ans[2]+=1
  else:
    ans[3]+=1
print("AC x " +str(ans[0]))
print("WA x "+str(ans[1]))
print("TLE x "+str(ans[2]))
print("RE x "+str(ans[3]))

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

int main() {
  int N, P;
  string S;
  cin >> N;
  vector<tuple<string, int, int>> vec;
  for (int i = 0; i < N; i++) {
    cin >> S >> P;
    P = 100 - P;
    vec.push_back(make_tuple(S, P, i + 1));
  }

  sort(vec.begin(), vec.end());

  int ans;
  for (int i = 0; i < N; i++) {
    tie(ignore, ignore, ans) = vec.at(i);
    cout << ans << endl;
  }
}

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

int main(){
  int num;
  int x;
  bool chk = true;
  cin >> num;
  
  for(int i = 0; i < num; i++){
    cin >> x;
    if(x % 2 == 1) continue;
    else{
      if(x % 3 == 0 || x % 5 == 0) continue;
      else chk = false;
    }
  }
  
  if(chk == true) cout << "APPROVED";
  else cout << "DENIED";
}


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

int main() {
  long N,K,Q;
  cin >> N >> K >> Q;
  vector<long>A(Q,0);
  for(int i = 0;i<Q;i++)
  {
    cin >> A.at(i) ;
  }
  vector<long>B(N,K-Q);
  for(int i = 0;i<Q;i++)
  {
    B.at(A.at(i)-1) += 1;
  }
  for(int i = 0;i < N;i++)
  {
    if(B.at(i) > 0)
    {
      cout << "Yes" << endl;
    }
    else
    {
      cout << "No" << endl;
    }
  }
}


Measured memory_bytes: 2176
import sys
m, d = map(int, input().split())

if d < 22:
    print(0)
    sys.exit()

count = 0
for month in range(1, m+1):
    for day in range(22, d+1):
        str_day = str(day)
        d1 = int(str_day[0])
        d2 = int(str_day[1])
        if d1 <= 1 or d2 <=1:
            continue
        if d1 * d2 == month:
            count += 1
print(count)

Measured memory_bytes: 3064
import java.util.Scanner;

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

    int d = a / b;
    int r = a % b;
    String f = String.format("%.5f", ((double)a / (double)b));

    System.out.println(d + " " + r + " " + f);
  }
}

Measured memory_bytes: 17320
N = int(input())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

cnt = 0
for i in reversed(range(N)):
    A[i] += cnt
    dcnt = (A[i] + B[i] - 1) // B[i] * B[i] - A[i]
    cnt += dcnt

print(cnt)

Measured memory_bytes: 15012
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;

int		main(void)
{
	ll N, K;
	cin >> N >> K;
	if (N > K)
	{
		N %= K;
		N += K;
	}
	ll ans1 = abs(N-K);
	ll ans2 = abs(abs(N-K)-K);
	cout << min(ans1, ans2) << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;


int main() {
	double pi = 3.141592653;

	double r;
	cin >> r;

	printd(r * 2 * pi);
	return 0;
}


Measured memory_bytes: 3784
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

from collections import Counter
import itertools
import copy

h,w,K=L()
c=[]
c_row=[]
c_col=[]
b=0
for i in range(h):
    ci=list(input())
    c_row.append(ci.count('#'))
    b+=c_row[-1]
    c.append(ci)
for i in range(w):
    c_col.append(0)
    for j in range(h):
        c_col[-1]+=1 if c[j][i]=='#' else 0

ans=0
s=set()
for i in range(2 ** h):
    sum=0
    dup=[[0 for a in range(w)]for b in range(h)]
    dupnum=0
    for k in range(h):
        if (i>>k)&1:
            sum+=c_row[k]
            for a in range(w):
                dup[k][a]+=1
    tmpdup=copy.deepcopy(dup)
    tmpsum=sum
    for j in range(2 ** w):
        for l in range(w):
            if (j>>l)&1:
                sum+=c_col[l]
                for a in range(h):
                    dup[a][l]+=1
        
        tmp=""
        for i in range(h):
            for j in range(w):
                tmp+=str(dup[i][j])
                if dup[i][j]==2 and c[i][j]=='#':
                    dupnum+=1
        if(tmp in s):
            sum=tmpsum
            dup=copy.deepcopy(tmpdup)
            dupnum=0
            continue
        else:
            s.add(tmp)
        if b-(sum-dupnum)==K:
            ans+=1
        sum=tmpsum
        dup=copy.deepcopy(tmpdup)
        dupnum=0
print(ans)


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

#define ll long long

using namespace std;

ll gcd(ll a, ll b){
    if(a % b == 0) return b;
    else return gcd(b, a % b);
}

int main(){
    ll A,B;
    cin >> A >> B;
    cout << (A * B) / gcd(A, B);

}

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

#define ff      first
#define ss      second
#define pb      push_back
#define ll      long long
#define MX      100005
#define inf     1000000
#define mod     1000000007
#define endl    "\n"

#define W(t)            while(t--)
#define all(v)          v.begin(),v.end()
#define ZERO(a)         memset(a,0,sizeof(a))
#define MINUS(a)        memset(a,-1,sizeof(a))
#define rep(i,a,b)      for(i = a; i < b; i++)
#define IOS             ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;

int par[MX + 5], n, m;

int find(int v)
{
	if (par[v] < 0) return v;
	else return par[v] = find(par[v]);
}
int main()
{
	IOS

	int i,cnt=0;
	
	cin >> n >> m;

	rep(i, 1, n + 1) par[i] = -1;
	W(m)
	{
		int x, y; cin >> x >> y;
		int r1 = find(x);
		int r2 = find(y);

		if (r1 != r2) {
			par[r1] = r2;
		}
	}
	rep(i, 1, n + 1){
		if(par[i]==-1)
			cnt++;
	}

	cout << cnt-1 << endl;
}

Measured memory_bytes: 4020
#include <iostream>
#include <algorithm>

using namespace std;

int a[100005];
int dp[100005];

int main() {
	int n,k;
	cin >>n>>k;
	for (int i=0 ; i<n ; i++) cin >>a[i];
	dp[0]=0;
	for (int i=1 ; i<n ; i++) {
		int minn=1e9;
		for (int j=max(0, i-k) ; j<i ; j++) {
			minn = min(minn, dp[j]+abs(a[j]-a[i]));
		}
		dp[i]=minn;
	}
	cout <<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    int N; cin >> N;
    vector<int> A(N); for (auto &a : A) cin >> a;
    int n = 1;
    for (int i = 0; i < N; i++) {
        if (A[i] == n) {
            n++;
        }
    }
    if (n == 1) {
        cout << -1 << endl;
    } else {
        cout << N - (n - 1) << endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define mp make_pair
#define ss second
#define ff first
#define ll long long int
#define tcase ll t;cin>>t;while(t--)
#define sz(a) int((a).size())
#define pb push_back
#define present(c,x) (�.find(x) != �.end())
#define cpresent(c,x) (find(all�,x) != �.end())
#define YES cout<<"YES\n";
#define NO cout<<"NO\n";
#define Yes cout<<"Yes\n";
#define No cout<<"No\n";
#define f(i,a) for(int i=0;i<a;i++)
#define in insert
const ll M=1e9+7;

using namespace std;

int main()
{

     int n,m,sum=0;
     cin>>n;
     vector<int> v(n);
     for(int &x: v)
     {
        cin>>x;
        sum+=x;
     }
     cin>>m;
     int p,x;
     while(m--)
     {
         cin>>p>>x;
         cout<<sum+x-v[p-1]<<endl;

     }


    return 0;
}


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

#define iFOR(idx, from, upto) for (int  idx = from; idx < upto; ++idx)
#define lFOR(idx, from, upto) for (long idx = from; idx < upto; ++idx)

#define ll long long

using namespace std;

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

    int length = s.length();

    // 回文かどうか判定
    for (int i = 0; i < (length - 1) / 2; i++) {
        if (s[i] != s[length - i - 1] || s[i] != s[(length + 1) / 2 + i]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    return

#B
def B():
    return

#C
def C():
    s = S()
    k = I()
    for i in range(k):
        if s[i] != "1":
            print(s[i])
            quit()
    print(1)

#D
def D():
    n,m,q = LI()
    v = [[] for i in range(n)]
    for i in range(m):
        l,r = LI()
        v[l-1].append(r-1)
    for i in range(n):
        v[i].sort()
    f = [[bisect.bisect_right(v[i],j) for j in range(n)] for i in range(n)]
    for i in range(q):
        p,q = LI()
        p -= 1
        q -= 1
        ans = 0
        for j in range(p,q+1):
            ans += f[j][q]
        print(ans)
#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    D()


Measured memory_bytes: 68316
#include<iostream>
#include<math.h>
using namespace std;

int main() {
	bool prime[55001] = { false };
	for (int i = 2; i <= sqrt(55000); i++) {
		if (!prime[i]) {
			for (int j = 2; i*j <= 55000; j++) {
				prime[i*j] = true;
			}
		}
	}
	int n;
	while (cin >> n) {
		for (int i = n-1;; i--) {
			if (!prime[i]) {
				cout << i << " ";
				break;
			}
		}
		for (int i = n+1;; i++) {
			if (!prime[i]) {
				cout << i << endl;
				break;
				}
			}
		}
}


Measured memory_bytes: 3136
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

void pad(string &s, int n, char c = '0') {
	string p = "";
	rep(i, 0, n - s.size())p += c;
	s = p + s;
}

signed main() {
	for (int a, L; cin >> a >> L && (a || L);) {
		string s = to_string(a);
		pad(s, L);
		int cnt = 0;
		map<string, int> mp;
		while (mp.count(s) == 0) {
			mp[s] = cnt;
			cnt++;

			sort(s.begin(), s.end());
			int m = stoi(s);
			reverse(s.begin(), s.end());
			int M = stoi(s);
			s = to_string(M - m);
			pad(s, L);
		}
		cout << mp[s] << " " << stoi(s) << " " << cnt - mp[s] << endl;
	}
	return 0;
}

Measured memory_bytes: 3228