akhauriyash/Code-Regression huggingface dataset:
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void Taka() { cout << "Takahashi" << endl; }
void Aoki() { cout << "Aoki" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }
void IOup() { cin.tie(0); ios::sync_with_stdio(false); }

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

	return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <cstdio>
#define N 200005
using namespace std;

typedef long long ll;
ll n, c, b, a[N];
int main()
{
	ll i, j;
	cin >> n;
	for (i = 0; i < n; i++) scanf("%lld", &a[i]);
	for (i = j = n - 1; i >= 0; b ^= a[i], i--) {
		for (; b & a[i]; b ^= a[j], j--);
		c += j - i + 1;
	}
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>


int main() 
{
	int a = 1, b = 1;
	while (b<=9) {
		printf("%dx%d=%d\n", b, a, a*b);
		a++;
		if (a >= 10) {
			b++;
			a = 1;
		}
	}
	return 0;
}

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

#define int             long long
#define	ll				long long

#define	mod 			1000000007
#define	inf 			1000000000000000
#define infty			1000000000000000000LL
#define	md				998244353
#define	PI				acos(-1.0)
#define	endl 			"\n"
#define	rr				return
#define	br				cout<<"\n";
long long prime[1000000];

void sieve()
{
	prime[0]=0;
	prime[1]=0;
	for(int i=2;i<1000000;i++)
		prime[i]=1;

	for(int i=2;i*i<1000000;i++)
		if(prime[i]==1)
			for(int j=i*i;j<1000000;j+=i)
				prime[j]=0;
}

bool isPrime(int n)
{
    if (n <= 1)
        return false;
    for (ll i = 2; i <= floor(sqrt(n)); i++)
        if (n % i == 0)
            return false;

    return true;
}

int factorial(int n)
{
    int f=1;
    for(int i = 1;i<=n ; i++)
        f = (f*i)%mod;
    return f;
}

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

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

int fastExponentiation(int n, int x, int modulo)
{
	int res = 1;
	while(x > 0)
       {
          if(x & 1)
          res = (res*n) % modulo;
          x = x >> 1;
          n = (n * n) % modulo;
       }
       return res;
}

int power(int n , int p )
{
	if(p==0)
	   return 1;

	 int res = power((n*n)%mod,p/2);
	 if(p%2==1)
	   res = (n*res)%mod;

	   	 return res;
}

bool isPowerOfTwo(int n)
{
   	return n && (!(n&(n-1)));
}

bool isSet(int n,int i)
{
	// To check if ith bit is set or not in binary representation of n
   	return n & (1 << i);
}

bool valid_coordinate(ll x,ll y,ll n,ll m)
{
    if(x<0 || y<0)
       return false;

   	else if(x>=n || y>=m)
       return false;

   	else
   		return true;
}

int sod(int n)
{
	int sum=0;
	while(n)
	{
		sum+=(n%10);
		n/=10;
	}
	return sum;
}



void solve()
{
	int k,n;
	cin>>k>>n;
	set<int>s;
	for(int i =0;i<n;i++){
		int h;
		cin>>h;
		s.insert(h);
	}
	int min=INT_MAX,index;
	for(int i =k;i>=-1000;i--){
		if(s.count(i)==0){
			if(min>k-i){
				min=k-i;
				index=i;
				break;
			}
		}
	}
	for(int i =k;i<=1000;i++){
		if(s.count(i)==0){
			if(min>i-k){
				min=i-k;
				index=i;
				break;
			}
		}
	}
	cout<<index<<endl;
	
}

int32_t main()
{

	//int t; cin>>t; while(t--)
	solve();

	return 0;
}


Measured memory_bytes: 3724
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
        int a = sc.nextInt();
        String op = sc.next();
        int b = sc.nextInt();
          if (op.equals("?")) break;
          if (op.equals("+")){
            System.out.println(a+b);
          }
          if (op.equals("*")){
            System.out.println(a*b);
          }
          if (op.equals("-")){
            System.out.println(a-b);
          }
          if (op.equals("/")){
            System.out.println(a/b);
          }

      }
    }
  }


Measured memory_bytes: 26108
a = gets.chomp.split("")
b = gets.chomp.split("")
c = gets.chomp.split("")

nex = a.shift
while true
  if nex == "a" then
    nxar = a
    if nxar.empty? then
      puts "A"
      exit
    end
  elsif nex == "b" then
    nxar = b
    if nxar.empty? then
      puts "B"
      exit
    end
  elsif nex == "c" then
    nxar = c
    if nxar.empty? then
      puts "C"
      exit
    end
  end
  nex = nxar.shift
end


Measured memory_bytes: 1788
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        if (a < b && b < c) {
        	System.out.println("Yes");
        } else {
        	System.out.println("No");
        }
        scanner.close();
    }
}


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

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

    vector<int> a(n);

    for (size_t i = 0; i < n  ; ++i)
    {
        cin >> a[i];
    }
    int count = 0;
    for (size_t i = 1; i < n - 1  ; ++i)
    {
        if(((a[i-1] < a[i])&&(a[i] < a[i+1]))||((a[i+1] < a[i])&&(a[i] < a[i-1]))){
            count++;
        }
    }
    cout << count << endl;
    return 0;   
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static Scanner scanner = new Scanner(System.in);

	public static void main(String[] args) {

		int a = input();
		int b = input();

		System.out.print(a / b);
		System.out.print(" ");
		System.out.print(a % b);
		System.out.print(" ");
		System.out.print(String.format("%.5f", (double) a / b));

		close();

	}

	public static int input() {

		return scanner.nextInt();

	}

	public static void close() {

		if (scanner != null) {

			scanner.close();

		}
	}
}

Measured memory_bytes: 26444
#include <iostream>

#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include <cstdlib>
#include <typeinfo>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;

template<class T>
void print(const T &value) {
    std::cout << value << std::endl;
}

void yesno(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl; }

void YESNO(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl; }

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

template<class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//ll INF = 10000000;
//ll mod = 1000000007;//10^9+7

//using Graph = vector<vector<pair<int, int>>>;
//Graph G(100100);


//番号ズレ注意！！
int main() {
    int n;
    cin >> n;
    ll a[n];
    REP(i, n) {
        cin >> a[i];
    }
    //+-+-+-パターン
    ll cnt1 = 0;
    ll sum1[n + 1];
    sum1[0] = 0;
    REP(i, n) {
        sum1[i + 1] = sum1[i] + a[i];
        if (i % 2 == 0 && sum1[i + 1] <= 0) {
            cnt1 += 1 - sum1[i + 1];
            sum1[i + 1] = 1;
        }
        if (i % 2 == 1 && sum1[i + 1] >= 0) {
            cnt1 += 1 + sum1[i + 1];
            sum1[i + 1] = -1;
        }
    }
    //-+-+-+パターン
    ll cnt2 = 0;
    ll sum2[n + 1];
    sum2[0] = 0;
    REP(i, n) {
        sum2[i + 1] = sum2[i] + a[i];
        if (i % 2 == 1 && sum2[i + 1] <= 0) {
            cnt2 += 1 - sum2[i + 1];
            sum2[i + 1] = 1;
        }
        if (i % 2 == 0 && sum2[i + 1] >= 0) {
            cnt2 += 1 + sum2[i + 1];
            sum2[i + 1] = -1;
        }
    }
    print(min(cnt1, cnt2));
}


Measured memory_bytes: 2560
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <iterator>
#include <algorithm>
#include <cfenv>
#include <random>
#include <numeric>
#include <cmath>
#include <iosfwd>
#include <iostream>
#include <ios>
#include <streambuf>
#include <istream>
#include <ostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <cstdlib>

#define SIZE 100002
typedef long long ll;
 
using namespace std;
 

int main(){
    string S;
    cin >> S;
    if(S == "ABC"){
        cout << "ARC";
    }else if(S == "ARC"){
        cout << "ABC";
    }
    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
 
using namespace std;
 
// typedef
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<string> vs;
 
// container util
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for (typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
// repetition
#define FOR(i,m,n) for (ll (i) = ((ll) m); (i) < ((ll) n); ++(i))
#define RFOR(i,m,n) for (ll (i) = ((ll) (m)-1); (i) >= ((ll) n); --(i))
#define REP(i,n) FOR(i,0,n)
 
// i/o
#define TFOUT(b,t,f) cout << ((b)? (t) : (f)) << endl
 
//constant
const double    EPS     = 1e-10;
const double    PI      = acos(-1.0);
const int       INFTY   = (1<<21);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl


int main(void) {
    string s; cin >> s;
    int g_cnt = 0, p_cnt = 0;
    for (const char c : s) {
        if (c == 'g') g_cnt++;
        else p_cnt++;
    }
    cout << (g_cnt - p_cnt) / 2 << endl;
    return 0;
}


Measured memory_bytes: 512
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll r,g,b;
    cin >> r >> g >> b;
    if((g*10 + b)%4 == 0) cout << "YES"<<endl;
    else cout << "NO"<<endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
const int MAXN=100000;
char s[MAXN];
int n;
int main()
{
    scanf("%d",&n);
    scanf("%s",s+1);
    for(int i=1;i<=strlen(s+1);i++)
    putchar('A'+(s[i]-'A'+n)%26);


    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <set>
typedef long long ll;

int main(void) {
  ll i, j, k, n, ans = 0, cnt = 0;
  scanf("%lld%lld", &n, &k);
  bool flg = false, b[n];
  ll a[n];
  std::set<ll> s;
  std::set<ll>::iterator it;
  for(i = 0; i < n; ++i) {
    scanf("%lld", &a[i]);
    if(i < k) s.insert(a[i]);
    if(i) {
      if(a[i] > a[i - 1]) b[i] = false;
      else b[i] = true;
      if(i < k) cnt += b[i] ? 1 : 0;
    }
  }
  if(cnt) ++ans;
  else flg = true;
  for(i = k; i < n; ++i) {
    it = s.end(), it--;
    cnt += (b[i] ? 1 : 0) - (b[i - k + 1] ? 1 : 0);
    if((a[i] < *it || *s.begin() != a[i - k]) && cnt) ++ans;
    if(!cnt) flg = true;
    s.erase(s.find(a[i - k])), s.insert(a[i]);
  }
  printf("%lld", ans + (flg ? 1 : 0));
  return 0;
}

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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

int main() {
source:
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    while (true) {
        c -= b;
        if (c <= 0) {
            cout << "Yes" << endl;
            return 0;
        }
        a -= d;
        if (a <= 0) {
            cout << "No" << endl;
            return 0;
        }
    }
    return 0;
}



Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define int long long
#define all(x) begin(x), end(x)
#define SZ(x) ((int)(x).size())
#define EB emplace_back
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define de(x) if(x && x == MODE)
#define MODE 1

using namespace std;

typedef pair<int, int> pii;
const int INF = 1e18;
const int maxn = 1e5 + 7;

struct ds {
    int p[maxn] = {};

    ds() {
        for (int i=1; i<=maxn; i++) {
            p[i] = i;
        }
    }

    int clan(int x) {
        return x == p[x] ?  x : p[x] = clan(p[x]);
    }

    void join(int x, int y) {
        x = clan(x);
        y = clan(y);
        if (x == y)
            return;
        p[y] = x;
        return;
    }
}ds;

bool v[maxn] = {};

main() {
    int i,j;
    int N, M;

    cin >> N >> M;
    for (int i=1; i<=M; i++) {
        int a,b;
        cin >> a >> b;
        ds.join(a,b);
    }
    int cnt = 0;
    for (int i=1; i<=N; i++) {
        int cl = ds.clan(i);
        if (!v[cl]) {
            v[cl] = 1;
            cnt++;
        }
    }

    printf("%lld\n", cnt-1);

    return 0;
}

//
//          ___ ___  __________  __________
//         /////\  \/\   ______\/\\\\\\\\\\\  Code by ~Ice Tea~ of
//        //// \ \  \ \  \_____/\ \\\\_____/      New Empire of CHSH ...
//       ////   \ \  \ \  \      \ \\\\\\\\\\\
//      ////__   \ \  \ \  \      \ \\\\_____/
//     ///////\   \ \  \ \  \______\ \\\\_______   ________
//    ////____/    \ \__\ \___   ___\ \\\\\\\\\\\ _\  ___  \_
//   /__/           \/__/\/__/\  \__/\ \\\\_____//\  .\_/\_  \
//                           \ \  \   \ \\\\\\\\\\\\  \_\/_\  \
// ... with the AC Power of   \ \  \   \ \\\\_____/ \   _____  \
//   The Great Tsundere Doggy. \ \  \   \ \\\\     \ \  \  \ \  \
//                              \ \__\   \ \\\\\\\\\\ \__\  \ \__\
//                               \/__/    \/________/\/__/   \/__/
//


Measured memory_bytes: 4680
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[9]={1,0,-1,0,1,1,-1,-1,0};
const ll dx[9]={0,-1,0,1,1,-1,1,-1,0};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll dp[3010][3010][4];
ll it[3010][3010];
int main(){
    ll r,c,pp;cin >> r >> c >>pp;
    map<pl,ll> mp;
    rep(i,pp){
        ll a,b,c;cin >> a>> b >> c;a--;b--;
        it[a][b]=c;
    }
    rep(i,3010)rep(j,3010)rep(k,4)dp[i][j][k]=-1;dp[0][0][0]=0;
    rep(i,r){
        rep(j,c){
            rep(k,4){
                if(dp[i][j][k]==-1)continue;
                if(k<=2)chmax(dp[i+1][j][0],dp[i][j][k]+it[i][j]);
                chmax(dp[i+1][j][0],dp[i][j][k]);
                if(k+1<=3)chmax(dp[i][j+1][k+1],dp[i][j][k]+it[i][j]);
                chmax(dp[i][j+1][k],dp[i][j][k]);
            }
        }
    }
    ll ans=0;
    rep(j,4)chmax(ans,dp[r-1][c][j]);
    rep(j,4)chmax(ans,dp[r][c-1][j]);
    //rep(j,4)chmax(ans,dp[r-1][c-1][j]);
    cout << ans <<endl;
} 

Measured memory_bytes: 357220
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////

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

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
	
	ll H, W, A, B;
	cin >> H >> W >> A >> B;

	ll ans = 0;

	COMinit();

	repn(i, W - B) {
		ll x = COM(H - A - 1 + B - 1 + i, H - A -1)*COM(A - 1 + W - B - i, A - 1) % MOD;
		ans = (ans + x) % MOD;
	}

	cout << ans;


	system("PAUSE");
}

Measured memory_bytes: 23928
import java.util.Scanner;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    char[] s = sc.next().toCharArray();
    char[] t = sc.next().toCharArray();
    int ans = 0;
    for (int cnt = 0; cnt < s.length; cnt++) {
      if (s[cnt] != t[cnt]) {
        ans++;
      }
    }
    System.out.println(ans);
    sc.close();
  }
}


Measured memory_bytes: 41468
n, q = map(int, input().split())
s = input()
dat_q = []
for i in range(q):
    l, r = map(int, input().split())
    dat_q.append((l, r))

c = [0] * n
for i in range(1, n):
    if s[i-1:i+1] == "AC":
        c[i] = c[i-1] + 1
    else:
        c[i] = c[i-1]
for i in range(q):
    l, r = dat_q[i][0], dat_q[i][1]
    print(c[r - 1] - c[l - 1])

Measured memory_bytes: 19804
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

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

ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}

//-----------------------ここから-----------

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

    int g[55][55] = {0};

    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a][b]++;
        g[b][a]++;
    }

    for(int i = 0; i < n; i++){
        int ans = 0;
        for(int j = 0; j < n; j++){
            if(i == j) continue;
            if(g[i][j] >= 1){
                ans += g[i][j];
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
use std::cmp;
use std::io::{stdin, Read};

macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $tr:tt $($r:tt)*) => {
        let $var = parse_val!($it, $tr);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $tr:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $tr);
        parse!($it $($r)*);
    };
}

macro_rules! parse_val {
    ($it: ident, [$tr:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $tr)).collect::<Vec<_>>();
    };
    ($it: ident, $tr: ty) => {
        $it.next().unwrap().parse::<$tr>().unwrap()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, n: usize, mut a: [usize; n]);
    let mut il = a.iter().enumerate().collect::<Vec<_>>();
    il.sort_by_key(|(i, &x)| x);
    il.reverse();
    let il = il.into_iter().map(|(i, x)| i).collect::<Vec<_>>();
    a.sort();
    a.reverse();
    let diff = |x, y| if x > y { x - y } else { y - x };
    let mut dp = vec![vec![0; n + 2]; n + 2];
    for x in 0..(n + 1) {
        for y in 0..(n + 1) {
            if x + y >= n {
                break;
            }
            dp[x + 1][y] = cmp::max(dp[x + 1][y], dp[x][y] + diff(x, il[x + y]) * a[x + y]);
            dp[x][y + 1] = cmp::max(
                dp[x][y + 1],
                dp[x][y] + diff(n - y - 1, il[x + y]) * a[x + y],
            );
        }
    }
    let mut ret = 0;
    for i in 0..n {
        ret = cmp::max(dp[i][n - i], ret);
    }
    println!("{}", ret);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 33456
#D
import fractions

a, b = map(int, input().split())

kouyaku = fractions.gcd(a, b)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
import collections
c = collections.Counter(prime_factorize(kouyaku))
d =list(c.values())
print(len(d) +1)


Measured memory_bytes: 64216
//#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

#ifdef DEBUG
#else
    #define cerr if (false) cerr
#endif

template <typename T> istream& operator>>(istream& in, vector <T>& a) {for (auto& i : a) in >> i; return in;}
template <typename T> ostream& operator<<(ostream& out, vector <T>& a)  {for (auto& i : a) out << i << " "; return out;}
template <typename T, typename U> void chkmin(T& a, U b) {if (a > b) a = b;}
template <typename T, typename U> void chkmax(T& a, U b) {if (a < b) a = b;}

const int MOD = 1e9 + 7;

int add(int x, int y) {
    x += y;
    if (x >= MOD)
        return x - MOD;
    return x;
}

int sub(int x, int y) {
    x -= y;
    if (x < 0)
        return x + MOD;
    return x;
}

int mul(int x, int y) {
    return (1LL * x * y) % MOD;
}

int bin_pow(int a, int p) {
    if (!p)
        return 1;
    if (p % 2)
        return (1LL * bin_pow(a, p - 1) * a) % MOD;
    int t = bin_pow(a, p / 2);
    return (1LL * t * t) % MOD;
}

int inv(int x) {
    return bin_pow(x, MOD - 2);
}




int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int k;
    cin >> k;
    string s;
    cin >> s;
    int n = s.size();
    /*vector <int> dp(n + k + 1);
    dp[0] = 1;
    int ans = 0;
    forn (i, 1, n + k + 1) {
        vector <int> new_dp(n + k + 1);
        forn (j, 0, n + k + 1)
            new_dp[j] = mul(25, dp[j]);
        forn (j, 1, n + k + 1)
            new_dp[j] = add(new_dp[j], dp[j - 1]);
        dp = new_dp;
        cerr << dp << "\n";
    }
    int sum = 0;
    forn (i, n, n + k + 1)
        sum = add(sum, dp[i]);
    //cerr << dp;
    cout << sum;*/
    vector <int> f(2e6 + 5);
    f[0] = 1;
    forn (i, 1, sz(f))
        f[i] = mul(f[i - 1], i);
    auto c = [&](int n, int k) {
        return mul(f[n], inv(mul(f[k], f[n - k])));
    };
    vector <int> p(2e6 + 5);
    p[0] = 1;
    forn (i, 1, sz(p))
        p[i] = mul(p[i - 1], 25);
    int ans = 0;
    int cur = k;
    forn (i, n, n + k + 1) {
        ans = add(ans, mul(p[cur], c(n + k, i)));
        cur--;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 20104
import sys

a=list(input())
b=list(input())
a.sort()
b.sort(reverse=True)
n=len(a)
m=len(b)

for i in range(min(n,m)):
    if a[i]>b[i]:
        print("No")
        sys.exit()
    elif a[i]<b[i]:
        print("Yes")
        sys.exit()
if n>=m:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define endl '\n'
#define pb push_back
#define mp make_pair
#define LL long long
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int n;
int main(){
	cin>>n;
	cout<<(n-1)/2+1<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define f(i, k, n) for (int i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define pb push_back
#define fr first
#define sc second
#define len(s) s.size()
#define all(v) v.begin(), v.end()
#define tr(it, v) for (auto &it : v)
#define bit(x) __builtin_popcount(x)
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef map<int, int> mii;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
// =================
void impgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1e9;
const int N = 3e5 + 1;

vi g[N];
int A[N];

void solve()
{
    int n, m, ans = 0, cnt = 0, k;
    cin>>n;
    vi h(n);
    f(i,0,n) cin>>h[i];
    vi dp(n,mod);
    dp[0]=0;
    f(i,0,n) {
        for(int j: {i+1,i+2}) {
            if(j<n) dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
        }
    }
    cout<<dp[n-1];
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t = 1;
    // cin >> t;
    while (t--)
        solve();

    return 0;
}

void impgraph(int n, int m)
{
    int i, u, v;
    while (m--)
    {
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }
}

void dfs(int u, int par)
{
    for (int v : g[u])
    {
        if (A[v])
        {
        }
        dfs(v, 0);
    }
}

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

using namespace std;

int main()
{
	string s;
	int w;
	cin >> s >> w;
	int n=(s.size()+(w-1))/w;
	for(int i=0; i<n; i++)
	{
		cout << s[i*w];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[55];
int main(){
    int n, k, ans = 0;
    scanf("%d%d", &n, &k);   
    for(int i=1;i<=n;i++) scanf("%d", &a[i]);
    for(int i=0;i<=n;i++){
        for(int j=i+1;j<=n+1;j++){
            int l = i, r = n-j+1;
            if(l+r > k) continue;
            int d = k-(l+r);
            vector<int> v;
            for(int x=1;x<=i;x++) v.push_back(a[x]);
            for(int x=j;x<=n;x++) v.push_back(a[x]);
            sort(v.begin(), v.end());
            int sum = 0;
            for(int i=0;i<v.size();i++) sum += v[i];
            for(int i=0;i<min((int)v.size(), d);i++){
                if(v[i] < 0) sum -= v[i];
            }
            ans = max(ans, sum);
        }
    }
    printf("%d\n", ans);
}


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


int main(){
	long long k,n,a,sum=0;
	cin >> k >> n;
	for(int i=0;i<n;i++){
		cin >> a;
		sum+=a;
	}
	if(sum>=k) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	   public static void main(String args[]){
		      Scanner scan = new Scanner(System.in);
		      int[] h,m,s;
		      h = new int[6];
		      m = new int[6];
		      s = new int[6];
		      for(int i=0;i<6;i++){
		         h[i] = Integer.parseInt(scan.next());
		         m[i] = Integer.parseInt(scan.next());
		         s[i] = Integer.parseInt(scan.next());
		      }
		      for(int i=1;i<6;i+=2){
		         if((s[i]-=s[i-1])<0){s[i]+=60;m[i]-=1;}
		         if((m[i]-=m[i-1])<0){m[i]+=60;h[i]-=1;}
		         h[i]-=h[i-1];
		      }
		      for(int i=1;i<6;i+=2){
		      System.out.println(h[i]+" "+m[i]+" "+s[i]);
		      }
		   }
}

Measured memory_bytes: 17128
#include <stdio.h>
#include <math.h>
int n,m,a,b,x,i,j,path[5000][3],pot[100],size;
void connect(int from,int to){
    int i;
    for(i=0;i<m;i++){if(pot[i]==from){pot[i]=to;if(to==0)n--;}}
}
void swap(int *x,int *y){int z; z=*x;*x=*y;*y=z;}
void heapify(int i){
	int p;
	if(i*2+1>=size)return;
	if(i*2+2>=size)p=i*2+1;
	else a=(path[i*2+1][2]>path[i*2+2][2]?(i*2+2):(i*2+1));
	if(path[a][2]<path[i][2]){
	swap(&path[a][0],&path[i][0]);
	swap(&path[a][1],&path[i][1]);
	swap(&path[a][2],&path[i][2]);
	heapify(a);
	}
}
int main(void){
    while(scanf("%d",&n)*n){
        for(i=0;i<n;i++)pot[i]=i+1;
        scanf("%d",&m);size=m;
        for(i=0;i<m;i++){
            scanf("%d,%d,%d",&a,&b,&x);
            path[i][2]=x;
            path[i][1]=b;
            path[i][0]=a;
        }
		for(i=(size-1)/2;i>=0;i--)heapify(i);
		x=0;m=n;
		for(;size>0;){
			a=pot[path[0][0]];b=pot[path[0][1]];
			if(a!=b){
				if(x==0){pot[path[0][0]]=0;pot[path[0][1]]=0;n-=2;}
				else{if(a<b)connect(b,a); else connect(a,b);}
				x+=path[0][2]/100-1;
			}
			swap(&path[0][0],&path[size-1][0]);
			swap(&path[0][1],&path[size-1][1]);
			swap(&path[0][2],&path[size-1][2]);
			size--;
			heapify(0);
		}
        printf("%d\n",x);
    }
    return 0;
}

Measured memory_bytes: 652
#include <algorithm>
#include <iostream>
#include <vector>
#include <tuple>
using namespace std;

int main() {
    int h, w; cin >> h >> w;
    vector<vector<int>> a(h, vector<int>(w));
    for (auto &ai: a) for (auto &aij: ai) cin >> aij, aij %= 2;
    vector<tuple<int, int, int, int>> res;
    for (int i = 0; i < h; i++) for (int j = 0; j + 1 < w; j++) {   // yoko
        if (a[i][j]) {
            a[i][j]--, a[i][j + 1] ^= 1, res.emplace_back(i, j, i, j + 1);
        }
    }
    for (int i = 0, j = w - 1; i + 1 < h; i++) {                    // tate
        if (a[i][j]) {
            a[i][j]--, a[i + 1][j] ^= 1, res.emplace_back(i, j, i + 1, j);
        }
    }
    cout << res.size() << endl;
    for (auto &tt: res) {
        int s, t, u, v; tie(s, t, u, v) = tt;
        cout << s + 1 << " " << t + 1 << " " << u + 1 << " " << v + 1 << endl;
    }
    return 0;
}


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

int main()
{
  char a , b , c , A , B , C ;
  int count ;
  
  cin >> a >> b >> c >>  A >> B >> C ;
  
  if(a==A)
    count++ ;
  if(b==B)
    count++ ;
  if(c==C)
    count++ ;
  
  cout << count << endl ;
}

Measured memory_bytes: 256
/* 23 - 35 */

#include <iostream>
#include <algorithm>
using namespace std;

string db(int n){
	string ret;
	for(int i=0;i<8;i++){
		ret+='0'+n%2;
		n/=2;
	}
	reverse(ret.begin(),ret.end());
	
	return ret;
}

string check(double n){
	double table[] = {1.0/2,1.0/4,1.0/8,1.0/16};
	for(int i=0;i<(1<<4);i++){
		double sum = 0;
		string ret = "";
		for(int j=0;j<4;j++){
			if( i & (1<<j) ){
				sum += table[j];
				ret += "1";
			}else{
				ret += "0";
			}
		}
		if(sum == n)return ret;
	}
	return "";
}
int main(){
	double n,dbl;
	
	while(cin >> n , n>=0 ){
		dbl = n-(int)n;
		if( (int)n < (1<<8) && check(dbl) != ""){
			cout << db( (int)n ) << "." << check(dbl) << endl;
		}else{
			cout << "NA" << endl;
		}
			
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define f(i,a,b) for(int i=a; i<b; i++)
using namespace std;

int main()
{
    IOS
    ll n, a, b;
    cin>>n;
    ll s = (ll)sqrt(n);
    for(ll i=s; i>=1; i--)
    {
    	if(n%i == 0) { a = i; break; }
    }
    b = n/a;
    cout<<a+b-2;
    return 0;
}

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

char field[100][100];
int H, W;

void dfs(int x, int y) {
  if(field[x][y] == '#') {
    field[x][y] = '0';
    for(int dx = -1 ; dx <= 1 ; dx++) {
      int nx = x + dx;
      if(0 <= nx && nx < H && field[nx][y] == '#') dfs(nx, y);
    }
    for(int dy = -1 ; dy <= 1 ; dy++) {
      int ny = y + dy;
      if(0 <= ny && ny < W && field[x][ny] == '#') dfs(x, ny);
    }
  }
  else if(field[x][y] == '*') {
    field[x][y] = '0';
    for(int dx = -1 ; dx <= 1 ; dx++) {
      int nx = x + dx;
      if(0 <= nx && nx < H && field[nx][y] == '*') dfs(nx, y);
    }
    for(int dy = -1 ; dy <= 1 ; dy++) {
      int ny = y + dy;
      if(0 <= ny && ny < W && field[x][ny] == '*') dfs(x, ny);
    }
  }
  else if(field[x][y] == '@') {
    field[x][y] = '0';
    for(int dx = -1 ; dx <= 1 ; dx++) {
      int nx = x + dx;
      if(0 <= nx && nx < H && field[nx][y] == '@') dfs(nx, y);
    }
    for(int dy = -1 ; dy <= 1 ; dy++) {
      int ny = y + dy;
      if(0 <= ny && ny < W && field[x][ny] == '@') dfs(x, ny);
    }
  }
}

int main() {
  int cnt;
  while(cin >> H >> W, H && W) {
    cnt = 0;
    memset(field, '0', sizeof(field));
    for(int i = 0 ; i < H ; i++) 
      for(int j = 0 ; j < W ; j++) cin >> field[i][j];
    
    for(int i = 0 ; i < H ; i++) {
      for(int j = 0 ; j < W ; j++) {
	if(field[i][j] != '0') {
	  dfs(i, j);
	  cnt++;
	}
      }
    }
    cout << cnt << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
vector<ll> div(ll a) {
    vector<ll> ret;
    if (a >= 2) ret.push_back(a);
    for (ll i = 2; i * i <= a; i++) {
        if (a % i == 0) {
            ret.push_back(i);
            if (i * i != a) ret.push_back(a / i);
        }
    }
    return ret;
}
/* function */
/* main */
int main(){
    ll N;
    cin >> N;
    ll ans = 0;
    vector<ll> c = div(N-1);
    ans += c.size();

    vector<ll> v = div(N);
    for (ll d : v) {
        ll tmp = N;
        while (tmp % d == 0) tmp /= d;
        if (tmp % d == 1) ans++;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3616
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
'''
def GI(V,E,DAG=False,index=0):
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[1:])
            bb=(inp[1:])
        g[a].append(b)
        if g[b].append(a)
        h.append(b)
'''

def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()
 
show_flg=False
#show_flg=True

ans=1

n=I()
a=LI()

col=[-1]*3
for i in a:
    
    N=sum([1*(c+1==i) for c in col])
    show(col,N,i)
    ans*=N
    ans%=mo
    for j in range(3):
        c=col[j]
        if c+1==i:
            col[j]+=1
            break

print(ans%mo)   
show(c)


Measured memory_bytes: 54992
n=int(input())
h=[int(x) for x in input().split()]
inf=1e9
dp=[inf]*(n)
dp[0]=0
for i in range(n):
    if i>=1:
        dp[i]=min(dp[i],dp[i-1]+abs(h[i]-h[i-1]))
    if i>=2:
        dp[i]=min(dp[i],dp[i-2]+abs(h[i]-h[i-2]))
print(dp[-1])

Measured memory_bytes: 52464
n = int(input())
lst_b = list(map(int,input().split()))
lst_a = []
i = 0
while True:
    if len(lst_b) == 0:
        break
    else:
        for i in range(len(lst_b)-1,-1,-1):
            if lst_b[i] == i+1:
                lst_a.append(lst_b.pop(i))
                break
            elif i == 0:
                print(-1)
                exit()

lst_a.reverse()

for i in range(n):
    print(lst_a[i])

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

int H;
int b[10][5];

struct range {
  int row;
  int left;
  int right;
};

void drop(int row, int col) {
  for (int i = row; i > 0; i--) {
    b[i][col] = b[i-1][col];
  }
  b[0][col] = -1;
}

void print_board() {
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < 5; j++) {
      cerr << b[i][j] << ' ';
    }
    cerr << endl;
  }
  cerr << endl;
}

void solve() {
  int ans = 0;
  while (1) {
    /* print_board(); */
    vector<range> deleted;
    for (int i = 0; i < H; i++) {
      int left = 0;
      for (int j = 1; j < 6; j++) {
        if (j == 5 || b[i][j] != b[i][j-1]) {
          if (j >= left + 3) {
            if (b[i][j-1] != -1) {
              range tmp = {i, left, j-1};
              deleted.push_back(tmp);
              ans += b[i][j-1] * (j - left);
            }
            break;
          } else {
            left = j;
          }
        }
      }
    }
    if (deleted.size() == 0) { break; }
    for (int k = 0; k < deleted.size(); k++) {
      range d = deleted[k];
      for (int j = d.left; j <= d.right; j++) {
        drop(d.row, j);
      }
    }
  }
  cout << ans << endl;
}

int main() {
  while (1) {
    cin >> H;
    if (H == 0) { break; }
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < 5; j++) {
        cin >> b[i][j];
      }
    }
    solve();
  }
}




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

int main(void) {
    int A,B,C;cin>>A>>B>>C;
    if (A == 5 && C == 5 && B == 7) cout << "YES" << endl;
    else if (A == 5 && C == 7 && B == 5) cout << "YES" << endl;
    else if (A == 7 && C == 5 && B == 5) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <utility>
#include <map>
#include<set>
#include <algorithm>
#include <string>
#include <string.h>
#include <iomanip>
#include <cmath>
#define ll long long
#define PI 3.14159265358979323846
#define lp(i, n) for (long long i = 0; i < n; i++)
#define rep(i, v) for (int i = 0; i < int(v.size()); i++)
using namespace std;
int main(){
	int n;
	cin>>n;
	multiset<int> ms;
	lp(i,n)
	{
		int a;
		cin>>a;
		auto it=ms.lower_bound(a);
		if(it==ms.begin())
			ms.insert(a);
		else
			{
				it--;
				ms.erase(it);
				ms.insert(a);	
			}
	}	
	cout<<ms.size();					
	return 0;
}

Measured memory_bytes: 4992
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		if(N%10==3) {
			System.out.println("bon");
			}
		if(N%10==0||N%10==1||N%10==6||N%10==8){
			System.out.println("pon");
			}
		if(N%10==2||N%10==4||N%10==5||N%10==7||N%10==9){
			System.out.println("hon");
		}
	}

}


Measured memory_bytes: 35508
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdlib, std.datetime;

immutable int N = 26;
//immutable int D = 365;
int D;
long[] C;
long[][] S;

void main() {
    auto stattime = Clock.currTime();
    D = readln.chomp.to!int;
    C = readln.split.map!(to!long).array;
    S = iota(D).map!(_ => readln.split.map!(to!long).array).array;

    auto ans = gen_initital_ans();
    auto score = calc_score(ans);

    while ((Clock.currTime - stattime).total!"msecs" < dur!"msecs"(1980).total!"msecs") {
        auto idx = uniform(0, D);
        auto next = uniform(0, N);
        auto cur = ans[idx];

        ans[idx] = next;
        auto next_score = calc_score(ans);
        if (next_score >= score) {
            score = next_score;
        } else {
            ans[idx] = cur;
        }
    }

    ans.each!(a => writeln(a+1));
}

int[] gen_initital_ans() {
    return D.iota.map!(_ => uniform(0, N)).array;
}

long calc_score(const ref int[] ans) {
    auto prev = new int[](N);
    long score = 0;
    foreach (i, a; ans) {
        score += S[i][a];
        score -= decrease(C[a], prev[a], i.to!int);
        prev[a] = i.to!int;
    }
    foreach (a; 0..26) {
        score -= decrease(C[a], prev[a], D-1);
    }
    return score;
}

long decrease(long c, int prev, int cur) {
    return (cur - prev - 1) * (cur - prev) / 2 * c;
}

Measured memory_bytes: 3712
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        NSData *stdinData = [[NSFileHandle fileHandleWithStandardInput] availableData];
        NSString *s = [[NSString alloc] initWithData:stdinData encoding:NSUTF8StringEncoding];
        NSString *answer = @"ABC";
        NSInteger score = [s integerValue];
        if(score>=1200){
            answer = @"ARC";
        }
        if(score>=2800){
            answer = @"AGC";
        }
        
        NSFileHandle *fileHandle = [NSFileHandle fileHandleWithStandardOutput];
        [fileHandle writeData:[answer dataUsingEncoding:NSUTF8StringEncoding]];
        [fileHandle writeData:[@"\n" dataUsingEncoding:NSUTF8StringEncoding]];
        [fileHandle closeFile];
    }
    
    return 0;
}


Measured memory_bytes: 8740
#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include<list>
#include<bitset>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<utility>
#include<fstream>
#include<sstream>
#include<cmath>
#include<stack>
#include<assert.h>
using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  ((B) <= (A) && (A) <= (C))

typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<PII > VP;

#define AIN(A, B, C) assert(IN(A, B, C))

//typedef int LL;
typedef long long int LL;
//typedef __int64 LL;

int main()
{
	int n, m, k;
	scanf("%d %d %d", &n, &m, &k);
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= m; j++) {
			int now = (n - i) * j + (m - j) * i;
			if (now == k) {
				printf("Yes\n");
				return 0;
			}
		}
	}
	printf("No\n");
	return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

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

	int h[n];
	rep(i, n) cin >> h[i];

	sort(h, h+n);

	int ans = 1e9 + 10;
	for(int i = 0; i + k - 1 < n; i++){
		ans = min(ans, h[i+k-1] - h[i]);
	}

	cout << ans << endl;
}


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

int main() {
	int n, k; cin >> n >> k;
	double ans = 0;
	for (int i = 1; i <= n; i++) {
		double tmp = 1.0 / n;
		int now = i;
		while (now < k) {
			now *= 2;
			tmp /= 2;
		}
		ans += tmp;
	}
	printf("%.10f", ans);

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
main(){
  int i,j,s,p,count = 0,a[100];
  scanf("%d", &s);
    for(i=0;i<s;i++){
      scanf("%d", &a[i]);
    }
    for(i=0;i<s;i++){
      for(j=s-1;j>i;j--){
	if(a[j] < a[j-1]){
          p = a[j];
          a[j] = a[j-1];
          a[j-1] = p;
          count++;
	}
      }
    }         
    for(i=0;i<s;i++){
      printf("%d",a[i]);
      if(i != s-1)
	printf(" ");
    }
    printf("\n%d\n",count);
    return 0;
}

Measured memory_bytes: 604
#include <iostream>

using namespace std;

int abs(int a) {
    if(a < 0){
        return -a;
    }
    return a;
}

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

    int min;
    int S1, S2;
    int sub;
    for(int T = 0; T < N - 1; T++) {
        S1 = 0;
        S2 = 0;
        for(int i = 0; i < N; i++) {
            if(i <= T) {
                S1 += W[i];
            } else {
                S2 += W[i];
            }
        }
        sub = abs(S1 - S2);
        if(sub < min || T == 0) min = sub;
    }

    cout << min << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
s = 0
c = True
for i in range(n):
    if i > 0:
        if a[i] != a[i-1]:
            s = 0
    if a[i] != b[i]:
        continue
    else:
        c = False
        while s != n:
            if a[i] != b[s] and a[s] != b[i]:
                b[i], b[s] = b[s], b[i]
                c = True
                break
            s += 1
        if not c:
            break
if not c:
    print("No")
else:
    print("Yes")
    print(*b)

Measured memory_bytes: 40120