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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define int                     long long int
#define ld                      long double
#define pb                      push_back
#define MOD                     1000000007
#define inf                     3e18
#define vi                      vector<int>
#define vld                     vector<ld>
#define pii                     pair<int,int>
#define mii                     map<int,int>
#define fi                      first
#define se                      second
#define fastIO                  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> pbds; 
		//order_of_key (k) : Number of items strictly smaller than k .
		//find_by_order(k) : K-th element in a set (counting from zero) (returns an iterator)           


void inp_out()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("debug.txt", "w", stderr);
	#endif
}

int32_t main()
{
	fastIO
	inp_out();

	string s; 
	cin >> s; 
	int val = 0; 

	for(int i = 0; i < s.size(); ++ i)
	{
		val += (s[i] - '0'); 
		val %= 9; 
	}

	cout << (val == 0 ? "Yes" : "No"); 

	return 0;
}

Measured memory_bytes: 3724
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;

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

	if(n < 2) cout << 1 << endl;
	else if(n < 4) cout << 2 << endl;
	else if(n < 8) cout << 4 << endl;
	else if(n < 16) cout << 8 << endl;
	else if(n < 32) cout << 16 << endl;
	else if(n < 64) cout << 32 << endl;
	else cout << 64 << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    string s; cin >> s;
    string t; cin >> t;
    int sl = s.size();
    int tl = t.size();
    for(int i = sl-tl;i >= -1; i--) {
        if (i == -1) {
            OUT("UNRESTORABLE")
            return 0;
        }
        bool ok = true;
        REP(j,tl) {
            if (s[i+j] == '?') continue;
            if (s[i+j] != t[j]) {
                ok = false; break;
            }
        }
        if (ok) {
            REP(j,tl) s[i+j] = t[j];
            break;
        }
    }

    REP(i,sl) if (s[i] == '?') s[i] = 'a';

    OUT(s)

    return 0;
}

Measured memory_bytes: 256
import bisect

A,B,Q = map(int,input().split())
S = [int(input()) for i in range(A)]
T = [int(input()) for i in range(B)]

for i in range(Q):
	x = int(input())
	ids = bisect.bisect_left(S,x)
	idt = bisect.bisect_left(T,x)
	ans = 0
	sl = -10000000000000000
	sr = 10000000000000000
	tl = -10000000000000000
	tr = 10000000000000000
	if ids!=0:
		sl = S[ids-1]
	if ids!=A:
		sr = S[ids]
	if idt!=0:
		tl = T[idt-1]
	if idt!=B:
		tr = T[idt]
	ans = min(max(sr,tr)-x,x-min(sl,tl))
	ans = min(ans,2*abs(x-sl)+abs(x-tr),abs(x-sl)+2*abs(x-tr),2*abs(x-sr)+abs(x-tl),abs(x-sr)+2*abs(x-tl))
	print(ans)

Measured memory_bytes: 12088
#include <iostream>  
#include <cstdio>  
using namespace std;  
  
#define N 100  
  
int n, m;  
char tile[N][N+1];  
int number;  
  
void dfs(int x, int y, char c)  
{  
    tile[x][y] = 'X';  
    int d[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};  
    for (int i = 0; i < 4; i ++) {  
        int nx = x + d[i][0], ny = y + d[i][1];  
        if (0 <= nx && nx < n && 0 <= ny && ny < m  
                && tile[nx][ny] == c) {  
            dfs(nx, ny, c);  
        }  
    }  
}  
  
void solve() {  
    int res = 0;  
    for (int i=0; i<n; i++) {  
        for (int j=0; j<m; j++) {  
            if (tile[i][j] != 'X') {  
                dfs(i, j, tile[i][j]);  
                res ++;  
            }  
        }  
    }  
    printf("%d\n", res);  
}  
  
int main(void)  
{  
    while (cin >> n >> m) {  
        if (!m && !n)  
            break;  
  
        for (int i=0; i<n; i++) {  
            cin >> tile[i];  
        }  
  
        solve();  
    }  
  
    return 0;  
}  


Measured memory_bytes: 4064
#include<algorithm>
#include<cmath>
#include<cctype>
#include<iomanip>
#include<iostream>
#include<map>
#include<string>
#include<vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define out(x) cout << x << endl;
#define each(e, v) for (auto&& e : v)
#define clamp(v,lo,hi) min(max(v,lo),hi)
#define debug(i) cout<<"point :"<< i << endl;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
typedef long long ll;
typedef vector<int> vint;
typedef vector<long> vl;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef map<string, int> mapstri;
typedef map<int, int> mapii;
typedef std::pair<int, int> pairii;

int main () {
    int a,b,c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b << endl;  
    return 0;
}

Measured memory_bytes: 888
///   ***   ---   |||         In the name of ALLAH        |||   ---   ***   ///



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


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

#define endl '\n'
#define PB push_back
#define F first
#define S second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define sz(x) (int)x.size()

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

#define mem(a,b) memset(a, b, sizeof(a) )
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}

ll gcd ( ll a, ll b ) { return __gcd ( a, b ); }
ll lcm ( ll a, ll b ) { return a * ( b / gcd ( a, b ) ); }

int main()
{
    optimize();

    string p[] = { "AC", "WA", "TLE", "RE" };

    map<string, int > cnt;

    int n;
    cin >> n;
    for ( int i = 1; i <= n; i++ ) {
        string s;
        cin >> s;
        cnt[s]++;
    }


    for ( int i = 0; i < 4; i++ ) {
        cout << p[i] << " x " << cnt[p[i]] << endl;
    }

    return 0;
}


















Measured memory_bytes: 3664
//2020.1.16
//s1270188 xxxmk2
//alds1_09a

#include<stdio.h>

#define N 250

int main(){
  int i , data[N+1], num;

  //input
  scanf("%d",&num);
  for(i=1;i<=num;i++) scanf("%d",&data[i]);

  //output
  for(i=1;i<=num;i++){
    printf("node %d: key = %d, ",i,data[i]);
    if(i!=1) printf("parent key = %d, ",data[i/2]);
    if(i*2<=num) printf("left key = %d, ",data[i*2]);
    if(i*2+1<=num) printf("right key = %d, ",data[i*2+1]);
    printf("\n");
  }
  
  return 0;
}



Measured memory_bytes: 2108
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#define lli long long int
#define uli unsigned long long int
#define inf 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define per(i,m,n) for(lli i=m-1;i>=n;i--)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
using namespace std;
int main(){
  int i;
  string s;
  cin>>s;
  rep(i,0,s.size())
    if(s.at(i)==',')s.at(i)=' ';
  cout<<s<<endl;
}

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

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

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
  }*/

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

  vi a(n);
  priority_queue<int> que;
  rep(i, 0, n){
    cin >> a[i];
    que.push(a[i]);
  }

  rep(i, 0, m){
    int t = que.top();
    que.pop();
    que.push(t/2);
  }

  int ans = 0;
  rep(i, 0, n){
    ans += que.top();
    que.pop();
  }

  cout << ans << endl;

  return 0;
}


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

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

  int n;
  cin >> n;

  int ans = 0;

  for (int i = 1; i <= n; ++i) {
    int a;
    cin >> a;

    if ((a & 1) && (i & 1)) ++ans;
  }

  cout << ans << '\n';

  return (0);
}


Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBUG = true;

int main(){

    ll a, b, k;
    cin >> a >> b >> k;

    if( k <= a ){
        cout << a - k << " " << b << endl;
    }
    else if( k <= (a + b) ){
        cout << 0 << " " << a + b - k << endl;
    }
    else {
        cout << 0 << " " << 0 << endl;
    }

    return 0;
}

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

int main(){
    int a,b;
    cin >> a >> b;
    
    cout<<a/b<<" "<<a%b<<" "<< fixed<<setprecision(20)<<1.0*a/b<<endl;
    
    return 0;
}




Measured memory_bytes: 3272
# 21   import sympyが最速だが、Atcoderには無い
import math
x = int(input())

#エラトステネスの篩
n = [i for i in range(2,int(math.sqrt(x))+1)]

for i in n:
    for j in n:
        if j % i == 0 and j/i !=1:
            n.remove(j)
            
while x > 0:
    for i in n:
        if x % i == 0:
            break
    else:
        print(x)
        break
    x+=1

Measured memory_bytes: 9184
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int,int> Pi;
const ll inf = 1e18 + 1;
const ll limit = 1e9;

int main() {
    int n; cin >> n;
    vector<int> x(n);
    int sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> x[i];
        sum += x[i];
    }
    double nokori = (double)sum / n - (sum / n);
    int p;
    if (nokori <= 0.5) p = sum / n;
    else p = (sum + n - 1) / n;
    ll ans = 0;
    for (int i = 0; i < n; i++) ans += (x[i] - p) * (x[i] - p);
    cout << ans << "\n";
}

Measured memory_bytes: 256
import itertools
import math
N = int(input())
ll = list()
for n in range(N):
    l = list(map(int, input().split()))
    ll.append(l)
p = list()
for i in range(N):
    p.append(i)
p = itertools.permutations(p)
total = 0
for i in p:
    for s in range(len(i) - 1):
        total += math.sqrt((ll[i[s]][0]-ll[i[s+1]][0])**2 + (ll[i[s]][1]-ll[i[s+1]][1])**2)
print(total/float(math.factorial(N)))

Measured memory_bytes: 3192
n = int(input())
al = [int(i) for i in input().split()]
bl = [int(i) for i in input().split()]

ans = 0
for i in range(n):
    if al[i] > bl[i]:
        ans += bl[i]
    elif al[i] + al[i+1] > bl[i]:
        ans += bl[i]
        al[i+1] = al[i+1] + al[i] - bl[i]
    else:
        ans += al[i] + al[i+1]
        al[i+1] = 0
        
print(ans)  

Measured memory_bytes: 19156
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <atcoder/all>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

using namespace atcoder;

int main(){
    int t;
    cin >> t;
    rep(i,t){
        ll n,m,a,b;
        cin >> n >> m >> a >> b;
        cout << floor_sum(n,m,a,b) << endl;
    }
    return 0;
}

Measured memory_bytes: 3600
// 20151015
// ??¨???????????¨???????????????????????????????????¨????°??????????. ????§??????§??????.




#include<stdio.h>




int main() {
  int i;
  int n;
  int kei = 100000;




  /* ??\??? */
  scanf("%d", &n);
  if (n > 100 || n <= 0) {
    return 0;
  }




  /* ?¨???? */
  for (i = 0; i < n; i ++) {
    kei = kei * 1.05;
    if (kei%1000 > 0) {
      kei = kei - kei%1000 + 1000;
    }
  }




  /* ??¨??? */
  printf("%d\n", kei);




  /* ?????? */
  return 0;
}

Measured memory_bytes: 588
#include <stdio.h>
int main(void){
    // Your code here!
    int N;
    scanf("%d",&N);
    int i,j;
    for(i=1;i<=9;i++){
        for(j=1;j<=9;j++){
            if(i*j==N){
                printf("Yes");
                return 0;
            }
        }
    }
    printf("No");
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define inf 1001001001
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(void) {
    int n; cin >> n;
    vector<bool> x(n+1, false);
    x[4] = x[7] = true;
    for (int i=8; i<=n; i++) {
        if(x[i-4]||x[i-7]) x[i] = true;
    }
    bool ans = false;
    if(x[n]) ans = true;
    if(ans) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;
int d[108][108];

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

	if(K>(N-1)*(N-2)/2){
		cout<<-1<<endl;
		return 0;
	}

	for (int i = 0; i < N; ++i){
		for (int j = i+1; j < N; ++j){
			d[i][j] = 1;
		}
	}
	int cnt = 0;
	for (int i = 0; i < N-1; ++i){
		for (int j = i+1; j < N-1; ++j){
			if(cnt >= K)i=N,j=N;
			d[i][j] = 0;
			cnt++;
		}
	}
	int M = 0;
	for (int i = 0; i < N; ++i){
		for (int j = i+1; j < N; ++j){
			if(d[i][j])M++;
		}
	}
	cout<<M<<endl;
	for (int i = 0; i < N; ++i){
		for (int j = i+1; j < N; ++j){
			if(d[i][j]){
				cout<<i+1<<" "<<j+1<<endl;
			}
		}
	}
	for (int i = 0; i < N; ++i){
		for (int j = 0; j < N; ++j){
			cerr<<d[i][j]<<" ";
		}
		cerr<<endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int P = 1e9 + 7;
inline int add(int a, int b) {if((a += b) >= P) a -= P; return a;}
inline int sub(int a, int b) {if((a -= b) < 0) a += P; return a;}
inline int mul(int a, int b) {return 1ll * a * b % P;}
inline int kpow(int a, int b) {int r=1;for(;b;b>>=1,a=mul(a,a)) {if(b&1)r=mul(r,a);}return r;}
//----
int n, m;
int main(){
	scanf("%d%d", &n, &m);
	ll ans = 0;
	rep(i, 0, n - m) ans += 100;
	rep(i, 0, m) ans += 1900;
	rep(i, 0, m) ans *= 2;
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 3804
// 2_abc134_b
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, d;
    cin >> n >> d;

    int ans = n / (2 * d + 1);
    if(n % (2 * d + 1) != 0) ans++;

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


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

int main()
{
    string s1, s2;
    int num1, num2;
    string threwBall;
    cin >> s1 >> s2 >> num1 >> num2 >> threwBall;

    cout << (s1 == threwBall ? num1 - 1 : num1) << " " << (s2 == threwBall ? num2 - 1 : num2) << endl;
}

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

using namespace std;
typedef long long ll;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FOR(i, a) for (int i = 0; i < (a); i++)

const int N = int(1e8) + 7;

void init(){

}

void solve(){
    map<string, vector<pair<int, int>>> m;
    vector<string> city;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        string s; int p;
        cin >> s >> p;
        city.push_back(s);
        m[s].push_back({p, i+1});
    }
    sort(city.begin(), city.end());
    auto last = unique(city.begin(), city.end());
    city.erase(last, city.end());
    for(int i = 0; i < city.size(); i++){
        string s = city[i];
        sort(m[s].begin(), m[s].end());
        reverse(m[s].begin(), m[s].end());
        for(int q = 0; q < m[s].size(); q++)
            cout << m[s][q].second << "\n";
    }
}

const bool mtc = false;

int main(){
    int t;
    if(mtc){
        scanf("%d", &t);
        while(t--) solve();
    }
    else solve();
}


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

using namespace std;

int main(void) {

	string str;
	int count = 0;

	cin >> str;

	for (int i = 0; i < str.size(); i++) {
		if (str[i] == '1') count++;
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
from itertools import permutations
from collections import defaultdict

N, C = list(map(int, input().split()))
D =[list(map(int, input().split())) for _ in range(C)]

remains = {0: defaultdict(int), 1: defaultdict(int), 2: defaultdict(int)}
for i in range(1, N+1):
    line = list(map(int, input().split()))
    for j in range(N):
        remains[(i+j+1)%3][line[j]] += 1

INF = float('inf')

def recolor(x, y, count):
    return D[x-1][y-1] * count

answer = INF
for choice in permutations(range(1, C+1), 3):
    _answer = 0
    for i, c in enumerate(choice):
        _answer += sum([recolor(r, c, remains[i][r]) for r in remains[i] if c != r])
    answer = min(answer, _answer)

print(answer)

Measured memory_bytes: 3444
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<stack>
#include<queue>
#include<sstream>
#include<string>
#include<set>
#include<array>
#include<cassert>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i);

using namespace std;

const int MAX_N=101;
const int MAX_W=10001;
const int INF=1<<29;

int dp[MAX_N][MAX_W];

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

	int wait[n],value[n];

	rep(i,n){
		cin >> value[i+1] >> wait[i+1];
	}

	for (int i = 0; i <= w; i++) {
		for (int j = 1; j <= n; j++) {
			if (i >= wait[j])
				dp[j][i] = max(dp[j-1][i], dp[j-1][i-wait[j]] + value[j]);
			else
				dp[j][i] = dp[j-1][i];
		}
	}

	cout << dp[n][w] << endl;

}

Measured memory_bytes: 5068
#include<iostream>
#include<algorithm>
using namespace std;
int abso(int value){
    if(value<0)value*=-1;
    return value;
}
int main(){
    int W,H,N,cnt=0;
    cin>>W>>H>>N;
    int sx,sy;
    cin>>sx>>sy;
    int gx,gy;
    while(--N){
        cin>>gx>>gy;
        int ax,ay;
        ax=abso(sx-gx);ay=abso(sy-gy);
        if((sx>gx&&sy>gy)||(sx<gx&&sy<gy))cnt+=max(ax,ay);
        else cnt+=ax+ay;
        sx=gx;sy=gy;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 1160
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N;
	ll A[200001],B[200001];
	priority_queue<pair<pll,int> > Q;
	scan(N);
	rep(i,N){
		scan(A[i]);
	}
	int flag=1;
	rep(i,N){
		scan(B[i]);
	}
	rep(i,N){
		if(B[(i+1)%N]>B[i]+B[(i+2)%N]){
			Q.push({{B[(i+1)%N],B[i]+B[(i+2)%N]},(i+1)%N});
		}
	}
	ll ans=0;
	while(Q.size()){
		pair<pll,int> Qtop=Q.top();
		Q.pop();
		ll b=Qtop.first.first,sa=Qtop.first.second;
		int i=Qtop.second;
		//printf("B[%d]:%lld A[%d]:%lld sa:%lld\n",i,b,i,A[i],sa);
		if(b<A[i]){
			flag=0;
			break;
		}
		else if(A[i]<sa){
			ll oldb=b;
			b%=sa;
			if(b==0) b=sa;
			ans+=(oldb-b)/sa;
			B[i]=b;
			if(B[(i+N-1)%N]>B[i]+B[(i+N-2)%N]){
				Q.push({{B[(i+N-1)%N],B[i]+B[(i+N-2)%N]},(i+N-1)%N});
			}
			if(B[(i+1)%N]>B[i]+B[(i+2)%N]){
				Q.push({{B[(i+1)%N],B[i]+B[(i+2)%N]},(i+1)%N});
			}
		}
		else if((b-A[i])%sa==0){
			ans+=(b-A[i])/sa;
			B[i]=A[i];
		}
		else{
			flag=0;
			break;
		}
		//printf("    B[%d]:%lld  ans:%lld\n",i,b,ans);
	}
	rep(i,N) if(A[i]!=B[i]) flag=0;
	if(flag) prin(ans);
	else prin(-1);
	return 0;
}


Measured memory_bytes: 8052
#include <bits/stdc++.h>
using namespace std;
int pos[]={0,4,6,8};
string s("AKIHABARA"),t,x;
int del[55]; 
int main() {
    cin>>x;
    for(int i=0;i<(1<<4);i++) {
        memset(del,0,sizeof(del));
        t.clear(); 
        for(int j=0;j<4;j++) {
            if(i>>j&1) del[pos[j]] = true;   
        }
        for(int j=0;j<s.size();j++) {
            if(del[j]) continue;
            else t.push_back(s[j]);
        }
        if(x==t) {
            puts("YES");
            return 0;
        }
    }
    puts("NO");
    return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
l=[]
for i in range(m):
  s,c=map(int,input().split())
  l.append((s-1,str(c)))
for i in range(1000):
  d=list(str(i))
  if len(d)!=n:continue
  for j in l:
    if d[j[0]]!=j[1]:break
  else:
    print(i)
    break
else:
  print(-1)
    


Measured memory_bytes: 3064
using System;
using System.Linq;

namespace _0027
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (a[0] == a[1] && a[1] == 0) { break; }
                int[] m = new int[13];
                m[1] = 31;
                m[2] = 29;
                m[3] = 31;
                m[4] = 30;
                m[5] = 31;
                m[6] = 30;
                m[7] = 31;
                m[8] = 31;
                m[9] = 30;
                m[10] = 31;
                m[11] = 30;
                m[12] = 31;
                for(int i = 1; i < a[0]; i++)
                {
                    a[1] += m[i];
                }
                int y = a[1] % 7;
                if (y == 0) { Console.WriteLine("Wednesday"); }

                if (y == 1) { Console.WriteLine("Thursday"); }
                if (y == 2) { Console.WriteLine("Friday"); }
                if (y == 3) { Console.WriteLine("Saturday"); }
                if (y == 4) { Console.WriteLine("Sunday"); }
                if (y == 5) { Console.WriteLine("Monday"); }
                if (y == 6) { Console.WriteLine("Tuesday"); }
            }
        }
    }
}

Measured memory_bytes: 9248
#include <bits/stdc++.h>
#define ALL(e) e.begin(), e.end()
#define RALL(e) e.rbegin(), e.rend()
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define dbg(x) (cerr << #x << ":" << x << endl)
#define mid (l + r) / 2
#define pii pair <int, int>
#define fi first
#define sc second
#define N 1000000009

using namespace std;

typedef long long lli;
#define int lli
const int mod = 1e9 + 7;
const int ne = 1e5 + 5;

int f[ne], inv[ne], finv[ne];

int com(int n, int k){
	if(n <= 0 or k > n) return 0;
	return (f[n] * ((finv[k] * finv[n - k]) % mod)) % mod;
}

signed main(){
	ios::sync_with_stdio(0);

	f[0] = f[1] = inv[0] = inv[1] = finv[0] = finv[1] = 1;
	for (int i = 2; i < ne; i++) {
		f[i] = (f[i - 1] * i) % mod;
		inv[i] = (mod - (mod / i) * inv[mod % i] % mod) % mod;
		finv[i] = (finv[i - 1] * inv[i]) % mod;
	}

	int n, k;
	cin >> n >> k;

	vector <int> ar(n);
	for(int &x: ar) cin >> x;
	sort(ALL(ar));

	int res = 0;
	for(int i=0; i<n; i++){
		res += ((com(i, k-1) * ar[i]) % mod);
		res -= ((com(n-i-1, k-1) * ar[i]) % mod);
		res %= mod;
	}

	cout << res;

	return 0;
}


/*

	-5 -3 0 3 7 12 15 20

*/


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

#define pii pair<int,int>

int main() {
  int n, m;
  while(cin >> n >> m && n+m) {
    int a[n], b[m];
    int suma=0, sumb=0;
    for(int i=0; i<n;i++) {
      cin >> a[i];
      suma += a[i];
    }
    for(int i=0; i<m;i++) {
      cin >> b[i];
      sumb += b[i];
    }
    int sa = sumb-suma;
    pii ans = pii(200,200);
    for(int i=0;i<n;i++) {
      for(int j=0;j<m;j++) {
        if (sa == 2*(b[j]-a[i])) {
          if (ans.first + ans.second > b[j]+a[i])
            ans = pii(a[i],b[j]);
        }
      }
    }
    if (ans.first == 200)
      cout << -1 << endl;
    else
      cout << ans.first << " " << ans.second << endl;
  }
}

Measured memory_bytes: 0
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
for(var i=0;i<Arr.length;i++){
   var arr=Arr[i].split("").map(Number);
   while(arr.length!=1){
      var c=[];
      for(var j=0;j<arr.length-1;j++){
         var ab=arr[j]+arr[j+1];
         c.push(ab%10);
      }
      arr=c.slice();
   }
console.log(arr[0]);
}

Measured memory_bytes: 7644
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    ll A[9];
    REP(i,9) A[i]=1LL<<50;
    ll N;
    cin>>A[1]>>A[2]>>A[4]>>A[8];
    cin>>N;
    N*=100;
    REP(i,9) REP(j,9){
        REP(k,9) if(k*i+j<9){
            A[k*i+j]=min(A[k*i+j],k*A[i]+A[j]);
        }
    }
    ll ans=0;
    for(int i=8;i>=1;--i){
        ans+=(N/(25*i))*A[i];
        N-=(N/(25*i))*(25*i);
    }
    cout<<ans<<endl;
}


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

int main()
{
	std::string s1, s2;
	std::cin >> s1 >> s2;

	int a1, a2;
	std::cin >> a1 >> a2;

	std::string s3;
	std::cin >> s3;

	if( s1 == s3 )	a1 --;
	if( s2 == s3 )	a2 --;

	std::cout << a1 << " " << a2 << std::endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("700 600 780");
            //1300
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("10000 10000 10000");
            //20000
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();
        Console.WriteLine(wkArr.OrderBy(X => X).Take(2).Sum());
    }
}


Measured memory_bytes: 13396
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
#define out(s) cout<<s<<endl;
#define Reverse(x) reverse(all(x));
#define Sort(x) sort(all(x));
#define pb(s) push_back(s);
#define sp " " 
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(lli i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    cout << std::fixed << std::setprecision(10);
    lli a, b,k;
    cin >> a >> b >> k;
    lli c = true;
    rep(i, k) {
        if(c)
        {
            if(a%2!=0)
            {
                a--;
                
            }
            b += a / 2;
            a -= a / 2;
            c = false;
        }
        else
        {
            if(b%2!=0)
            {
                b--;
               
            }
            a += b / 2;
            b -= b / 2;
            c = true;
        }
    }
    out(a << sp << b);
}

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

const ll M = 1000000007;
//べき乗高速化
ll mpow(ll x, ll n){
	ll ans = 1;
	while(n != 0){
		if (n&1) ans = ans * x % M;
		x = x*x % M;
		n  = n >> 1;
	}
	return ans;
}


int main(){
	ll n,k;
	cin >> n >> k;
	vector<ll> count(k+1,0);
	ll ans = 0;
	for (int i = k; i >= 1 ; --i) {
		ll x = k/i;
		ll temp = mpow(x, n);
		for (int j = 2; j <= k; ++j) {
			if(i*j > k) break;
			temp -= count[i*j];
		}
		count[i] = temp;
	}
	REP(i,k){
		ans += i*count[i] % M;
	}
	cout << ans % M << endl;
    return 0;
}



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

int main(){
    int H, W, K;
    cin >> H >> W >> K;
    string S[800];
    for(int i=0; i<H; i++) cin >> S[i];
    int dist[800][800];
    queue<pair<int, int>> que;
    for(int i=0; i<H; i++) for(int j=0; j<W; j++){
        dist[i][j] = 1e9;
        if(S[i][j] == 'S'){
            que.push({i, j});
            dist[i][j] = 0;
        }
    }

    int dx[] = {0, 0, 1, -1};
    int dy[] = {1, -1, 0, 0};
    auto inside = [&](int i, int j){ return i>=0 && i<H && j>=0 && j<W; };

    while(que.size()){
        auto p = que.front(); que.pop();
        int i = p.first, j = p.second;
        for(int k=0; k<4; k++){
            int x = i+dx[k];
            int y = j+dy[k];
            if(inside(x, y) && S[x][y] != '#' && dist[x][y] == 1e9){
                dist[x][y] = dist[i][j] + 1;
                que.push({x, y});
            }
        }
    }

    int ans = 1e9;
    for(int i=0; i<H; i++) for(int j=0; j<W; j++) if(dist[i][j] <= K){
        int d = min({i, H-1-i, j, W-1-j});
        ans = min(ans, (d+K-1)/K + 1);
    }
    cout << ans << endl;
}

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

typedef long long ll;
typedef pair<int, pair<int, int>> piii;
//loop
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//STL
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

//const
#define MOD 1000000007 //10^9+7:合同式の法

//acronym
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

const int INF = 1e9;

#define deg_to_rad(deg) ((deg)*M_PI / 180.0)

int gcd(int x, int y)
{
    if (x < y) swap(x, y);
    if (y == 0) return x;
    else return gcd(y, x % y);
}

void Main()
{
    int x, y;
    cin >> x >> y;

    cout << gcd(x, y) << endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    Main();
    return 0;
}



Measured memory_bytes: 3204
using System;
using System.Collections.Generic;
using System.Linq;

namespace AOJ.Volume2
{
    public class PrimeQuadruplet
    {
        public static int Main()
        {
            // 10000000??\???????´???°????±???????
            var prime = new bool[10000001];
            prime[0] = false;
            prime[1] = false;
            prime[2] = true;
            var prime_list = new List<int>() { 2 };
            for (int i = 3; i <= 10000000; i++)
            {
                bool is_prime = true;
                foreach (var p in prime_list)
                {
                    if (i % p == 0)
                    {
                        is_prime = false;
                        break;
                    }

                    if (p * p >= i) { break; }
                }

                if (is_prime)
                {
                    prime_list.Add(i);
                    prime[i] = true;
                }
                else { prime[i] = false; }
            }

            // 4???????´???°????±???????
            var quad_prime = new List<int>();
            foreach(var p in prime_list)
            {
                if (prime[p + 2] && prime[p + 6] && prime[p + 8]) { quad_prime.Add(p + 8); }
            }

            while (true)
            {
                int n = int.Parse(Console.ReadLine());
                if(n == 0) { break; }

                int ans = 0;
                foreach(var q in quad_prime)
                {
                    if (q > n) { break; }
                    ans = q;
                }

                Console.WriteLine(ans);
            }
            return 0;
        }
    }
}

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

using namespace std;

using ll = long long;

const int MX = 2007;

int a[MX];
int cost[MX];

int main() {
#ifdef BZ
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int n;
    cin >> n;
    int x;
    cin >> x;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        cost[i] = a[i];
    }
    ll ans = 1e18;
    for (int i = 0; i <= n + 1; i++) {
        ll cans = 0;
        for (int j = 0; j < n; j++) {
            cost[j] = min(cost[j], a[(i + j) % n]);
            cans += cost[j];
        }
        ans = min(ans, cans + 1ll * x * i);
    }
    cout << ans << "\n";
}




Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int N;
int F[110][10];
int P[110][10];
long long INF = 1e12;

long long score(int open[10]) {
  int j, k;
  long long ans = 0;
  for (j = 0; j < N; j++) {//店jとの関係を処理
    int same = 0;
    for (k = 0; k < 10; k++) {//k番目の時間
      if (open[k] == F[j][k] && open[k] > 0) {
	same += 1;
      }
    }
    //printf("same = %d", same);
    ans += P[j][same];
  }
  return ans;
}
  

int main() {
  int i, j;
  int open[10] = {};
  long long ans = (-1)*INF;
  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    for (j = 0; j < 10; j++) {
      scanf("%d", &F[i][j]);
    }
  }
  for (i = 0; i < N; i++) {
    for (j = 0; j < 11; j++) {
      scanf("%d", &P[i][j]);
    }
  }
  for (i = 1; i < 1024; i++) {
    if (i % 1024 >= 512) {
      open[0] = 1;
    } else {
      open[0] = 0;
    }
    if (i % 512 >= 256) {
      open[1] = 1;
    } else {
      open[1] = 0;
    }
    if (i % 256 >= 128) {
      open[2] = 1;
    } else {
      open[2] = 0;
    }
    if (i % 128 >= 64) {
      open[3] = 1;
    } else {
      open[3] = 0;
    }
    if (i % 64 >= 32) {
      open[4] = 1;
    } else {
      open[4] = 0;
    }
    if (i % 32 >= 16) {
      open[5] = 1;
    } else {
      open[5] = 0;
    }
    if (i % 16 >= 8) {
      open[6] = 1;
    } else {
      open[6] = 0;
    }
    if (i % 8 >= 4) {
      open[7] = 1;
    } else {
      open[7] = 0;
    }
    if (i % 4 >= 2) {
      open[8] = 1;
    } else {
      open[8] = 0;
    }
    if (i % 2 >= 1) {
      open[9] = 1;
    } else {
      open[9] = 0;
    }
    long long ans_now = score(open);
    if (ans_now > ans) {
      ans = ans_now;
    }
    //for (j = 0; j < 10; j++) {
    //  printf("%d", open[j]);
    //}
    //printf(" %lld\n", ans_now);
  }
  printf("%lld", ans);
  return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main{
	
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int n=sc.nextInt(),q;
    long sum=0;
    int[] a=new int[n],x=new int[100001];
    for(int i=0;i<n;i++){
      a[i]=sc.nextInt();
      x[a[i]]++;
      sum+=(long)a[i];
    }
    
    q=sc.nextInt();
    int[] b=new int[q],c=new int[q],d=new int[q];
    for(int i=0;i<q;i++){
      b[i]=sc.nextInt();
      c[i]=sc.nextInt();
      d[i]=c[i]-b[i];
      sum=sum+(long)(x[b[i]]*d[i]);
      System.out.println(sum);
      x[c[i]]+=x[b[i]];
      x[b[i]]=0;
    }
  }
}


Measured memory_bytes: 64108
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll field[505][505]={0};
void judge(ll H,ll W,ll h,ll w){
  ll rsum[505][505]={0};
  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      rsum[i][j]=field[i-1][j-1];
    }
  }
  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      rsum[i][j]+=rsum[i][j-1];
    }
  }
  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      rsum[i][j]+=rsum[i-1][j];
    }
  }
  for(int i=h;i<=H;i++){
    for(int j=w;j<=W;j++){
      ll ksum=rsum[i][j]+rsum[i-h][j-w];
      ksum-=rsum[i-h][j];
      ksum-=rsum[i][j-w];
      if(ksum>=0){
        cout<<"No"/*<<i<<" "<<j*/<<endl;
        return;
      }
    }
  }
  if(rsum[H][W]<=0){
    cout<<"No"<<endl;
    return;
  }
  cout<<"Yes"<<endl;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++) cout<<field[i][j]<<" ";
    cout<<endl;
  }
  return;
}
int main(){
  ll H,W,h,w;
  cin>>H>>W>>h>>w;
/*  if(H%h==0&&W%w==0){
    cout<<"No"<<endl;
    return 0;
  } */
  ll hk=H/h,wk=W/w;
  ll val=1e8*5;
  for(int i=0;i<H;i+=h){
    for(int j=0;j<W;j+=w) field[i][j]=val;
  }
  for(int i=h-1;i<H;i+=h){
    for(int j=w-1;j<W;j+=w) field[i][j]=-1*(val+1);
  }
//  cout<<"Yes"<<endl;
/*  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++) cout<<field[i][j]<<" ";
    cout<<endl;
  } */
  judge(H,W,h,w);
}


Measured memory_bytes: 6784
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(12), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int main() {
    int N; cin >> N;
    vector<tuple<int, int, int>> A(N);
    for (int i = 0; i < N; i++) {
        int x, y; cin >> x >> y; A[i] = make_tuple(x, y, i);
    }
    dsu ds(N);
    for (int t = 0; t < 2; t++) {
        sort(begin(A), end(A));
        map<int, int> M;
        for (int i = N - 1; i >= 0; i--) {
            auto [x, y, j] = A[i];
            auto it = M.lower_bound(y);
            if (it != M.end()) {
                ds.merge(j, it->second);
            }
            M[y] = j;
        }
        M.clear();
        for (int i = 0; i < N; i++) {
            auto [x, y, j] = A[i];
            auto it = M.lower_bound(y);
            if (it != M.begin()) {
                --it;
                ds.merge(j, it->second);
            }
            M[y] = j;
        }
        for (auto& [x, y, i] : A) {
            swap(x, y);
        }
    }
    for (int i = 0; i < N; i++) {
        cout << ds.size(i) << '\n';
    }
    return 0;
}

Measured memory_bytes: 15904
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    void solve() {
        Scanner sc = new Scanner(System.in);
        int cardNum = sc.nextInt(); // カード N 枚 ：(0 ~ N-1)
        int gateNum = sc.nextInt(); // ゲート M 個 ：(0 ~ M-1)
        int[] left = new int[gateNum];
        int[] right = new int[gateNum];
        for (int i = 0; i < gateNum; i++) {
            left[i] = sc.nextInt();
            right[i] = sc.nextInt();
        }

        int curStart = 1;
        int curEnd = cardNum;
        for (int i = 0; i < gateNum; i++) {
            int start = left[i];
            int end = right[i];

            // 共通部分なし
            if(end < curStart || curEnd < start) {
                System.out.print(0);
                return;
            }
            else {
                if (curStart < start) {
                    curStart = start;
                }
                if (end < curEnd) {
                    curEnd = end;
                }
            }
        }
        int ans = curEnd - curStart + 1;
        System.out.print(ans);
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
}

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

//input
ll n;
vector<ll>a;

ll d[60][60];

int main(){
    //input
    cin >> n;
    a.resize(n);
    rep(i,n){
        string s;
        cin >> s;
        bool flag = false;
        ll x = 0;
        ll res = 0;
        rep(j,s.size()){
            if(res==9)continue;
            if(s[j]=='.')flag=true;
            else{
                x = x*10+s[j]-'0';
                if(flag)res++;
            }
        }
        while(res<9){
            x*=10;
            res++;
        }
        a[i]=x;
    }
    rep(i,n){
        ll t=0;
        ll s=0;
        while(a[i]%2==0){
            t++;
            a[i]/=2;
        }
        while(a[i]%5==0){
            s++;
            a[i]/=5;
        }
        d[t][s]++;
    }
    ll ans = 0;



    rep(i,60){
        rep(j,60){
            rep(k,60){
                rep(l,60){
                    if(i==k&&j==l)continue;
                    if(i+k<18||j+l<18)continue;
                    ans += d[i][j]*d[k][l];
                }
            }
        }
    }
    ans /= 2;

    //自分自身のペアを考えるの忘れない
    ll res = 0;
    rep(i,60){
        rep(j,60){
            if(i*2<18||j*2<18)continue;
            res += d[i][j]*(d[i][j]-1)/2;
        }
    }
    cout << ans+res << endl;


    return 0;
}


Measured memory_bytes: 4700
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>

using std::string;
using std::vector;
using std::map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  ui a{}; cin >> a;
  string s{}; cin >> s;

  cout << (a >= 3200 ? s : "red") << CRLF;


  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


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

typedef long long ll;

const int Maxn = 100005;
const int Maxb = 60;

int n;
ll a[Maxn];
ll my[Maxb];
ll res;

void Write(ll num)
{
    for (int i = Maxb - 1; i >= 0; i--)
        if (num & 1ll << ll(i))
            if (my[i] == 0) { my[i] = num; break; }
            else num ^= my[i];
}

ll Get()
{
    ll res = 0;
    for (int i = Maxb - 1; i >= 0; i--)
        if (!(res & 1ll << ll(i)))
            res ^= my[i];
    return res;
}

int main()
{
    ll tot = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%lld", &a[i]);
        tot ^= a[i];
    }
    res = tot;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < Maxb; j++)
            if (bool(a[i] & 1ll << ll(j)) && bool(tot & 1ll << ll(j)))
                a[i] ^= 1ll << ll(j);
        Write(a[i]);
    }
    res += 2ll * Get();
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,a,n) for (register int i=a;i<=n;i++)
#define per(i,a,n) for (register int i=n;i>=a;i--)
#define FOR(i,a,n,x) for (register int i=a;i<=n;i+=x)
#define ROF(i,a,n,x) for (register int i=n;i>=a;i-=x)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define pii pair<int, int>
#define pil pair<int, long long>
#define pll pair<long long, long long>
#define VI vector<int>
#define ll long long
#define ull unsigned long long
#define lowbit(x) ((x)&(-x))
#define mem(i, a) memset(i, a, sizeof(i))
#define sqr(x) ((x)*(x))
#define ls (p << 1)
#define rs (p << 1 | 1)
using namespace std;

template <typename T>

inline void read(T &X) {
  X = 0; char ch = 0; T op = 1;
  for(; ch > '9' || ch < '0'; ch = getchar())
    if(ch == '-') op = -1;
  for(; ch >= '0' && ch <= '9'; ch = getchar())
    X = (X << 3) + (X << 1) + ch - 48;
  X *= op;
}

const int INF = 0x3f3f3f3f;
const int MAXN = 1e5 + 5;

int n;
ll sum = 0;

int main() {
#ifdef WiLe
  freopen ("input.txt", "rt", stdin);
#endif

  read(n);
  rep (i, 1, n) {
    rep (j, 1, n) {
      rep (k, 1, n) {
        sum += __gcd(__gcd(i, j), k);
      }
    }
  }

  cout << sum << endl;

#ifdef WiLe
  cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}
/*
# author : WiLe
# date : 2020/04/16
*/

Measured memory_bytes: 3644