akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
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...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
	char a,b;cin >> a >> b;
	int A = a == 'D';
	int B = b == 'D';
	cout << vector<char>{'H','D'}[(A+B)%2] << endl;

}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
using namespace std;
int main(void){
	string s;
	cin>>s;
	int sum = 0;
	for(int i = 0;i<2;i++){
		if(s[i]==s[i+1]&&s[i]==s[i+2]){
			sum++;
		}
	}
	if(sum>0){
		cout<<"Yes";
	}else{
		cout<<"No";
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  if (N <= 111) {
    cout << 111;
  }
  else if (N <= 222) {
    cout << 222;
  }
  else if (N <= 333) {
    cout << 333;
  }
  else if (N <= 444) {
    cout << 444;
  }
  else if (N <= 555) {
    cout << 555;
  }
  else if (N <= 666) {
    cout << 666;
  }
  else if (N <= 777) {
    cout << 777;
  }
  else if (N <= 888) {
    cout << 888;
  }
  else {
    cout << 999;
  }
}

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

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

    for(int i = 0; i < s.size(); ) {
        cout << s[i];
        i += 2;
    }

    cout << endl;

    return 0;
}


Measured memory_bytes: 512
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define in(x, l, r) (ll)(l) <= (x) && (x) < (ll)(r)

int main() {
    int X;
    cin >> X;
    if (X >= 30) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3592
// 三井住友信託銀行プログラミングコンテスト2019 B

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int, int> P;

void printVec(std::vector<int> &vec) {
  std::cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    std::cout << *it << " ";
  }
  std::cout << std::endl;
}

int main() {
 int x, n;

  cin >> n;

  for(int i = 0; i < n + 1; ++i) {
    x = i * 108/100;
    if (n == x) {
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
  
  return 0;
}


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

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}
int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}

//vc alp(26) ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//cout<<""<<endl;
int main(){
  char X,Y;cin>>X>>Y;
  if(X<Y)cout<<'<'<<endl;
  else if(X==Y)cout<<'='<<endl;
  else cout<<'>'<<endl;
}







Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// --------------------------------------------------------
#define FOR(i,l,r) for (int i = (l); i < (r); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define MIN(c) *min_element(ALL(c))
#define MAX(c) *max_element(ALL(c))
#define SUM(c) accumulate(ALL(c), 0)
#define SUMLL(c) accumulate(ALL(c), 0LL)
#define SZ(c) ((int)(c).size())
#define debug(x) cerr << #x << " = " << (x) << '\n';
using P = pair<int,int>;
using VP = vector<P>;
using VVP = vector<VP>;
using VS = vector<string>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<ll>;
using VVLL = vector<VLL>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
using VVD = vector<VD>;
static const double EPS = 1e-10;
static const double PI  = acos(-1.0);
static const ll MOD = 1000000007;
// static const ll MOD = 998244353;
static const int INF = 1 << 30;
// static const ll INF = 1LL << 62;
// --------------------------------------------------------


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

    string S; cin >> S;
    string ans;
    if (S.back() == 's') {
        ans = S + "es";
    } else {
        ans = S + "s";
    }
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
const ll Mod=1000000007;
const ll INF=999999999999999999;
const ll NN=(ll)(1e6+5);
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y) 
{ 
    if (y==0) 
        return 1; 
    else if (y%2==0) 
        return power(x,y/2)*power(x,y/2); 
    else
        return x*power(x,y/2)*power(x,y/2); 
}
ll hcf(ll a,ll b) 
{ 
    if(b==0) 
        return a; 
    return hcf(b,a%b);  
}
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE 
    	freopen("input.txt", "r", stdin); 
    	freopen("output.txt", "w", stdout); 
    	freopen("error.txt", "w", stderr); 
   #endif*/
   ll TT=1;
   //cin>>TT;
   while(TT--)
   {
       ll i,n,c=0,r=0,w=0;
       cin>>n;
       string s;
       cin>>s;
       for(char u:s)
        (u=='R'?r++:w++);
       for(i=0;i<r;i++)
         if(s[i]!='R')
          c++;
       cout<<c;   
   }
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

int main(){

    char c;cin>>c;

    int nextc=c;
    nextc++;
    char ans=nextc;
    cout<<ans<<"\n";

    return 0;

}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main(){
    int a , b , c , d , S;
    cin >> a >> b >> c >> d;
    if(a * b > c * d){
        S = a * b;
    }
    else{
        S = c * d;
    }
    cout << S << endl;
}

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

int main(){
  int i, j, n;
  cin >> n;
  for ( i = 0; i <= n / 4; i++ ){
    for ( j = 0; j <= n / 7; j++ ){
      if ( 4 * i + 7 * j == n ){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
using namespace std;
#define _GLIBCXX_DEBUG
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vit vector<lint>::iterator
#define all(x) (x).begin(),(x).end()
#define rep(x) for(int i = 0;i < (x);i++)
#define repj(x) for(int j = 0;j < (x);j++)
#define REP(i,x) for(int (i) = 0;(i) < (x);(i)++)
#define rrep(x) for(int i = (x);i >= 0;i--)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define mod 1000000007
#define graph_set(n) struct edge{int to,int cost;} vector<edge> G((n))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define range(x,y) ((x) >= 0 && (x) < h && (y) >= 0 && (y) < w)
#define pyes cout << "Yes" << endl
#define pno cout << "No" << endl
#define fin return 0
typedef vector<long long> vi;
typedef vector<pair<long long, long long>> vp;
typedef vector<vector<long long>> vvi;
typedef pair<long long, long long> pi;
typedef long long lint;
typedef long long ll;
lint qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
lint qp(ll a, ll b, int mo) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }
lint gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
long long INF = 1000000000000000;

int r[100], l[100];
int a, b;

#define MAX 9223372036854775807
/*********************** */

int main() {
	int n;cin >> n;
	vector<long long>a(n);rep(n)cin>>a[i];
	a[0]--;
	for(int i = 1;i < n-1;i++){
		if(a[i] > a[i-1])a[i]--;
		if(a[i] > a[i+1]){
			pno;return 0;
		}
	}
	pyes;
	return 0;
}


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

 int main() {
   int N, ans = 0;
   cin >> N;
   map<int, int> a;
   rep(i, N) {
     int tmp;
     cin >> tmp;
     a[tmp]++;
   }
   for (auto p: a) {
     if (p.second == p.first) continue;
     else if (p.second < p.first) ans += p.second;
     else if (p.second > p.first) ans += p.second - p.first;
   }
   cout << ans << endl;
 }


Measured memory_bytes: 4736
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define ld long double
#define vi vector<vector<ll> >
using namespace std;
const int MOD=1000000007;
const int MOD2=998244353;
const ll MAX=9187201950435737471;
const int N=100005;
const int INF=1e9+7;
const long double PI=acos(-1);



void solve(int T){
    int n;
    cin>>n;
    map<string,int>mp;
    while(n--){
        string s;
        cin>>s;
        mp[s]++;
    }
    cout<<"AC"<<" x "<<mp["AC"]<<"\n";
    cout<<"WA"<<" x "<<mp["WA"]<<"\n";
    cout<<"TLE"<<" x "<<mp["TLE"]<<"\n";
    cout<<"RE"<<" x "<<mp["RE"]<<"\n";
}

int main() {
    fastio

    int T=1;
    //cin>>T;
    for(int i=1;i<=T;i++){
        solve(i);
        if(i<T)cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
#define rreps(i, n) for(int i=((int)(n)); i>0; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pl(s) cout << (s) << "\n";
#define pls(...) {bool space = false; for(auto i : __VA_ARGS__) (cout << (space?" ":"") << i), space = true; cout << "\n";}
#define plexit(s) {cout << (s) << "\n"; exit(0);}
#define yes(s) cout << ((s)?"Yes":"No") << "\n";
#ifdef __LOCAL
#include <dump.hpp>
#define dump(...) DUMPOUT << "  " << string(#__VA_ARGS__) << ": " << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl << "    ", dump_func(__VA_ARGS__)
#else
#define dump(...)
#endif
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
struct IOInit { IOInit() { cin.tie(nullptr); ios::sync_with_stdio(false); dump("READY"); /*cout << unitbuf;*/} } IO_INIT;
using ll = long long; using ull = unsigned long long; using ld = long double;
template<typename T = int> using V = vector<T>; template<typename T = int> using P = pair<T, T>;
using Vi = V<int>; using Vl = V<ll>; using Vd = V<ld>; using VVi = V<Vi>; using VVl = V<Vl>; using Pi = P<int>; using Pl = P<ll>; using Pd = P<ld>;
constexpr ll MOD = 1000000007; constexpr int INF = (1 << 30) - 1; constexpr ll INFL = 1LL << 60; constexpr ld EPS = 1e-12; constexpr ld PI = 3.141592653589793238462643383279;



signed main(void) {
  int n, m; cin >> n >> m;
  Vl a(n), b(m);
  rep(i, n) cin >> a[i];
  rep(i, m) cin >> b[i];

  Vl c = convolution(a, b);
  pls(c);
  return 0;
}


Measured memory_bytes: 27284
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>

using namespace std;

int main() {
   string c1, c2, c3;
   cin >> c1 >> c2 >> c3;
   cout << c1[0] << c2[1] << c3[2] << endl;
   return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	long long int n;
	scanf("%lld", &n);
	long long int sum = 0;
	for(long long int i = 1; i <= n; i++){
		if(i % 3 == 0 && i % 5 == 0){
		continue;
		} else if(i % 3 == 0){
		continue;
		} else if(i % 5 == 0){
		continue;
		} else{
			sum += i;
		}
	}
	printf("%lld\n", sum);
	return 0;
}

Measured memory_bytes: 1704
from collections import deque
n = int(input())
a = list(map(int, input().split()))

d = deque()
t = 0
for i in a:
  if t == 0: d.append(i)
  elif t == 1: d.appendleft(i)
  t = 1 - t
  
if t == 0: print(*d)
else: print(*list(reversed(d)))

Measured memory_bytes: 32480
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

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

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n = sc.nextInt();
        int k = sc.nextInt();
        double ans=0;
        for (int i = 1; i <= n ; i++) {
			double e=1.0/n;
			long p=i;
			while(p<k) {
				e*=0.5;
				p*=2;
			}
			ans+=e;
		}

        out.println(ans);
        out.flush();
    }
    



    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

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

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

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

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


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

int main(){
    string s;
    ll k;
    cin >> s >> k;
    char a;
    int idx = 0;
    rep(i,s.size()) if(s[i] != '1'){
        a = s[i];
        idx = i;
        break;
    }
    if(idx >= k) cout << 1 << endl;
    else cout << a << endl;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#include<unistd.h>
using namespace std;
#define pb(x) push_back(x);
#define pi 3.141592653589793238L;
typedef long long  int ll;
ll mod = 998244353;
ll hmaxii=0;
vector<ll>values[2*100000+1];
ll MAXN = 2*100000+1;
ll spf[2*100000+1];
//vector<ll>values[];
ll diff,x,y,z;
ll flag=1;ll price[1001][1001];

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



void solution(){
    int a,b,h,m;
    cin>>a>>b>>h>>m;
     double theta = 3.141592653589793238L*((( double)h/6.0+( double)m/360.0-( double)m/30.0));
     double ans = ( double)(a*a)+( double)(b*b)-( double)(2*a*b*cos(theta));
    cout<<setprecision(11)<<sqrt(ans)<<endl;
}


int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //sieve();
    /*ll powe[64];
    powe[0]=1;
    ll i=1;
    while(i<64){
        powe[i] = powe[i-1]*2;
        i++;
    }*/
    ll t;
    //cin>>t;
    t=1;
    while(t--){
        solution();
    }
    return 0;
}


Measured memory_bytes: 8924
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define repd(i,a,b) for (int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    
    int N, M;
    cin >> N >> M;
    int ret = 0;
    rep(i, N){
        int k;
        cout << "lst " << i << endl;
        cin >> k;
        ret += k * (k - 1);
        rep(j, k){
            int c;
            cin >> c;
        }
    }
    
    cout << "ans " << ret << endl;
    return 0;
}

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

using namespace std;

int main(){
  int n, x = 0, y = 0;
  cin >> n;
  for(int i = 0; i < n; i++){
    string a,b;
    cin >> a >> b;
    if(a > b){
      x = x + 3;
    }else if(a < b){
      y = y + 3;
    }else{
      x = x + 1;
      y = y + 1;
    }
  }
  cout << x << " " << y << endl;
  return 0;
}


Measured memory_bytes: 3200
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;



public class Main {

	public static class pair implements Comparable<pair> {
		int id;
		int ans;
 
		pair(int x, int y) {
 
			id = x;
			ans = y;
 
		}
 
		public pair() {
 
		}
 
		public int compareTo(pair o) {
			// TODO Auto-generated method stub
 
			return this.id - o.id;
		}
	}
 
//	static int mod = (int) 998244353.;
	static ArrayList<Integer> gr[];
	static int[] ar;
	static Scanner sc = new Scanner(System.in);
	static int pri[] = new int[(int) 1e6 + 5];
	static StringBuilder out = new StringBuilder();
 
	//static long dp[];
 
	public static void main(String[] args) throws IOException {
		int t =1;//sc.nextInt();
		
		while (t-- > 0) {
 
			long a=sc.nextLong();
			long b=sc.nextLong();
			long n=sc.nextLong();
			if(n>=b) {
				long ans=((a*(b-1)/b));
						System.out.println(ans);
			}
			else {
				long ans=((a*n)/b);
				System.out.println(ans);
			}
			
			
		}
		
		System.out.println(out);
	}
 
	
}

Measured memory_bytes: 39696
N = int(input())
arr = list(map(int, input().split()))
count_list = [0]*N

for i in range(N):
    count_list[arr[i-1]-1] +=1

sum = 0
for i in range(N):
    if count_list[i] != 0:
        sum += int(count_list[i]*(count_list[i]-1)/2)

for i in range(N):
    print(sum+1-count_list[arr[i]-1])

Measured memory_bytes: 81356
N = int(input())
H = [int(x) for x in input().split()]
count = 0
A =[]

for i in range(N-1):
    if H[i] >= H[i+1]:
        count = count +1
        A. append(count)
    if H[i] < H[i+1]:
        count = 0
        A. append(count)

if N >1:
    print(max(A))
if N ==1:
    print(0)

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a[] = new int[3];
		for(int i=0;i<a.length;i++) {
			a[i] = sc.nextInt();
		}
		int k = sc.nextInt();
		int max = 0;
		int mid = 0;
		int sum = 0;
		for(int i=0;i<a.length-1;i++) {
			if(a[i]<a[i+1]) {
				max = a[i+1];
			}else {
				max = a[i];
			}
		}
		mid = max;
		for(int i=1;i<=k;i++) {
			mid = mid * 2;
		}
		sum = mid + a[0] + a[1] + a[2] - max;
		System.out.println(sum);
	}
}


Measured memory_bytes: 21844
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if (a == b && b == c) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;

int main()
{
  int x, y;
  while (true) {
    fscanf(stdin, "%d %d", &x, &y);
    if (x == 0 && y == 0) { break; }
    if (x > y) { swap(x, y); }
    fprintf(stdout, "%d %d\n", x, y);
  }
  return 0;
}

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

const static ll MOD = (1e+9)+7;

int main(){
    int h,w,n;cin>>h>>w>>n;
    vector<int> A(n,0);
    rep(i,n)cin>>A[i];
    vector<vector<int>> mp(h,vector<int>(w,-1));
    int i = 0;
    int j = 0;
    int clr = 1;
    while(1){
        mp[i][j] = clr;
        A[clr-1]--;
        if(A[clr-1] == 0)clr++;
        if(i%2==0)j++;
        else j--;
        if(j == w){
            i++;j--;
        }
        if(j == -1){
            i++;j++;
        }
        if(mp[h-1][w-1]!=-1 && mp[h-1][0] != -1)break;
    }
    rep(i,h){
        rep(j,w){
            cout<<mp[i][j]<<' ';
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
   int n,i,l,count,point;
   string hantei;
   queue<int> runner;
   
   cin>>n;
   for(i=0;i<n;i++){
      
      while(!runner.empty()) runner.pop();
      for(l=0;l<3;l++) runner.push(0);
      count=0;point=0;
      
      while(count!=3){
         cin>>hantei;
         
         if(hantei=="HIT"){
            runner.push(1);
            if(runner.front()==1) point++;
            runner.pop();
         }
         else if(hantei=="HOMERUN"){
            runner.push(1);
            for(l=0;l<3;l++) runner.push(0);
            
            for(l=0;l<4;l++){
               if(runner.front()==1) point++;
               runner.pop();
            }
         }
         else if(hantei=="OUT")
            count++;
      }
      cout<<point<<endl;
   }
   return 0;
}

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

int main()
{
    int K, A, B;
    cin >> K >> A >> B;
    bool multiple = false;

    for(int i=A;i<=B;i++) {
        if(i%K == 0) multiple = true;
    }

    if(multiple) cout << "OK" << endl;
    else cout << "NG" << endl;

    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define l_ength size
const int mod = 1000000007;
using ll = long long;
using namespace std;

const int r = 5, m = 13;
int ans[100100][13];
	
int main(){
	string s; cin >> s;
	int n = s.l_ength();
	ll cnt = 0;
	ans[0][0] = 1;
	for( int i = 0; i < n; ++i ){
		char c = s[i];
		if( c == '?' ){
			for( int p = 0; p < m; ++p ){
				for( int k = 0; k <= 9; ++k ){
					ans[i+1][(p*10+k)%m] += ans[i][p];
					ans[i+1][(p*10+k)%m] %= mod;
				}
			}
		} else {
			int k = c-'0';
			for( int p = 0; p < m; ++p ){
				ans[i+1][(p*10+k)%m] += ans[i][p];
				ans[i+1][(p*10+k)%m] %= mod;
			}
		}
	}
	cout << ans[n][r] << endl;
	return 0;
}

Measured memory_bytes: 5504
// Solution by ** Abhishek Mittal **
#include<iostream>
#include<fstream>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<math.h>

#define FIO ios_base::sync_with_stdio(0);  cin.tie(0);
#define PI 3.14159265358979323846
#define mod 1000000007
#define ll long long
#define vll vector<long long>  

#define all(c) c.begin(), c.end()

// Used to traverse in any STL container with iterators
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)

// Find whether element is present in given container or not
#define present(container, element) (container.find(element) != container.end())

// Finds whether element in present container is present in vector or not
#define cpresent(container, element) (find(all(container),element) != container.end())

using namespace std;



int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif
    FIO

    int n;
    cin>>n;
    int len[n];
    for(int i=0;i<n;i++)cin>>len[i];
    sort(len, len + n);
    int cnt = 0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                int a = len[i];
                int b = len[j];
                int c = len[k];
                if(a == b || b==c || a==c)continue;
                if(a + b > c)cnt++;
            }
        }
    }
    cout<<cnt<<endl;

    return 0;

}

Measured memory_bytes: 3148
#include<cstdio>

using namespace std;

int main(){
	int sum;
	int self;
	while(1){
		scanf("%d",&sum);
		if(sum == 0){break;}
		for(int i=0;i<9;i++){
			scanf("%d",&self);
			sum-=self;
		}
		printf("%d\n",sum);
	}
}

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

int main() {
  string s;
  cin >> s;
  vector<int> r(2);
  for (int i = 0; i < s.size(); i++) {
    for (int j = 0; j < 2; j++) {
      r[j] += (s[i] - '0' + j) % 2 == i % 2;
    }
  }
  cout << min(r[0], r[1]) << endl;
}


Measured memory_bytes: 512
PROGRAM piyo
      IMPLICIT NONE
      integer :: k, length
      character(100) :: s
      
      read*,k
      read*,s
      
      length = len_trim( s )
      
      if( length<=k )then
        print*,s
      else
        print*,s(1:k)//'...'
      end if
      
      
      
      
      
      END PROGRAM

Measured memory_bytes: 2856
using System;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var line = Console.ReadLine().Split(' ');

            var a = int.Parse(line[0]);
            var b = int.Parse(line[1]);

            if (a < b) Console.WriteLine("a < b");
            if (a == b) Console.WriteLine("a == b");
            if (a > b) Console.WriteLine("a > b");

        }
    }
}



Measured memory_bytes: 15952
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
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/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

const ll max_n=5000;
vi fac(max_n),finv(max_n),inv(max_n);
// テーブルを作る前処理 O(max_n)
void init(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  REP(i,2,max_n){
    fac[i]=fac[i-1]*i%mod;
    inv[i]=mod-inv[mod%i]*(mod/i)%mod;
    finv[i]=finv[i-1]*inv[i]%mod;
  }
}
// 二項係数計算 O(1)
ll COM(int n,int k){
  if(n<k) return 0;
  if(n<0||k<0) return 0;
  return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}
//init(); を忘れない！

void solve(){
  init();
  ll s; cin>>s;
  ll ans=0;
  REP(k,1,s/3+1){
    ll p=s-3*k;
    ans+=COM(p+k-1,k-1);
    ans%=mod;
  }
  out(ans);
}

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


Measured memory_bytes: 3772
n=int(input())
if n==1:
    a,b,c=map(int,input().split())
    print(max(a,b,c))
else:
    a=[]
    b=[]
    c=[]
    dp=[[0 for i in range(3)] for j in range(n)]
    temp=n
    i=1
    flag=0
    while n!=0:
        a,b,c=map(int,input().split())
        if n==temp:
            dp[0][0]=a
            dp[0][1]=b
            dp[0][2]=c
        else:
            dp[i][0]=max(dp[i-1][1]+a,dp[i-1][2]+a)
            dp[i][1]=max(dp[i-1][0]+b,dp[i-1][2]+b)
            dp[i][2]=max(dp[i-1][0]+c,dp[i-1][1]+c)
            i+=1
        n-=1

    if flag==1:
        print(max(a,b,c))
    else:
        print(max(dp[n-1][0],dp[n-1][1],dp[n-1][2]))

Measured memory_bytes: 24308
#include <bits/stdc++.h>
using namespace std;
int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    cout << (H - h) * (W - w) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <string.h>
using namespace std;
typedef long long ll;

//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#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--)

#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく

//定数
#define INF 1000000000000 //10^12:極めて大きい値,
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

using namespace std;

int main(void){
 
  string s;
  cin >> s;
  if( s[s.length()-1] == 's' ){
    cout << s + "es" << endl;
  } else {
    cout << s + "s" << endl;
  }
  return 0;
}



Measured memory_bytes: 3612
package main

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

var sc = bufio.NewScanner(os.Stdin)

func swap(a int, b int) (int, int) {
	return b, a
}

func GCD(a int, b int) int {
	if b > a {
		a, b = swap(a, b)
	}
	if b == 0 {
		return a
	} else {
		return GCD(a%b, b)
	}
}

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

func nextString() string {
	sc.Scan()
	s := sc.Text()
	return s
}

func CheckniconiLevel(s []rune) int {
	n := len(s)
	mx := 0
	tmp := 0
	fmt.Printf("%d\n", n)
	for i := 0; i < n-1; i++ {
		if s[i] == '2' && s[i+1] == '5' {
			tmp += 2
			i += 1
			mx = int(math.Max(float64(tmp), float64(mx)))
		} else {
			tmp = 0
		}
	}
	return int(mx)
}

func main() {
	sc.Split(bufio.ScanWords)
	ans := 0
	N := nextInt()
	K := nextInt()
	var A [2005]int
	var AllInv [2005]int
	var AftInv [2005]int
	MOD := int(1e9 + 7)
	for i := 0; i < N; i++ {
		A[i] = nextInt()
	}
	for i := 0; i < N; i++ {
		for j := i; j < N; j++ {
			if A[i] > A[j] {
				AftInv[i]++
			}
		}
	}
	for i := 0; i < N; i++ {
		for j := 0; j < N; j++ {
			if A[i] > A[j] {
				AllInv[i]++
			}
		}
	}
	for i := 0; i < N; i++ {
		times := (((K - 1) * K) / 2) % MOD
		ans = (ans + (AllInv[i] * times % MOD)) % MOD
		adds := (AftInv[i] * K) % MOD
		ans = (ans + adds) % MOD

	}
	fmt.Printf("%d\n", ans)
}


Measured memory_bytes: 640
N, W = map(int, input().split())
dp = [0]*(W+1)
for i in range(N):
    w, v = map(int, input().split())
    if w > W:continue
    for j in reversed(range(W+1)):
        if j >= w:
            dp[j] = max(dp[j], dp[j-w]+v)
print(dp[W])

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


int main() {
	
	int n;
	cin >> n;
	vector<int> a(n);
	double b=0;
	
	for(int i=0; i<n; i++) {
		cin >> a.at(i);
		b += (double)1/a.at(i);
	}
	cout << 1/b << endl;
	
	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var h, n, a, as int
	fmt.Scan(&h)
	fmt.Scan(&n)

	for i := 0; i < n; i++ {
		fmt.Scan(&a)
		as = as + a
	}

	var answer string

	if h <= as {
		answer = "Yes"
	} else {
		answer = "No"
	}

	fmt.Println(answer)
}


Measured memory_bytes: 5504
#include<bits/stdc++.h>
using namespace std;
// #define int long long
#define rep(i,n) for (int i = 0; i < n; ++i)
#define REP(i,k,n) for (int i = k; i <= n; ++i)
#define REPR(i,k,n) for (int i = k; i >= n; --i)
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair
#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define debug1(a) cout<<" "<<#a<<" : "<<a<<"\n"
#define debug2(a,b) cout<<" "<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<"\n"
#define debug3(a,b,c) cout<<" "<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<"\n"
#define debug4(a,b,c,d) cout<<" "<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<"\n"
// #define M 421412341324321
#define MOD 998244353

signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	int n;
	cin>>n;

	int a[n+1];

	rep(i,n-1) cin>>a[i+1];
	a[0] = a[1];
	a[n] = a[n-1];
	int ans=0;
	REP(i,1,n)
	{
		// cout<<min(a[i], a[i-1])<<" ";
		ans+=min(a[i], a[i-1]);
	}
	cout<<ans;



}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<int,int>;
using PP=pair<int,P>;
using Pl=pair<ll,ll>;
using PPl=pair<ll,Pl>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a<=c&&c<=a+b){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define max(a,b) (a)>(b)?(a):(b)
#define min(a,b) (a)<(b)?(a):(b)
int main(void)
{
  int n,m,x,y,zx[110],zy[110],x_max=-1000,y_min=1000;
  scanf("%d%d%d%d",&n,&m,&x,&y);
  for(int i=0;i<n;i++){
    scanf("%d",&zx[i]);
    x_max=max(x_max,zx[i]);
  }
  for(int i=0;i<m;i++){
    scanf("%d",&zy[i]);
    y_min=min(y_min,zy[i]);
  }
  puts((y_min>x&&x_max<y)&&(x<y&&y_min>x_max)?"No War":"War");
  return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 100010
#define LL long long
int n,L,T,a[MAXN],x,op;
LL c;
int main()
{
	scanf("%d%d%d",&n,&L,&T);
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d",&x,&op);
		if(op==1)
		{
			int p=x+T;
			if(p>0) (c+=p/L)%=n;
			a[i]=p%L;
		}
		else
		{
			int p=x-T;
			if(p<0) (c+=(p+1)/L-1)%=n;
			a[i]=(p%L+L)%L;
		}
	}
	sort(a+1,a+1+n);
	c=(c%n+n)%n;
	for(int i=c+1;i<=n;i++) printf("%d\n",a[i]);
	for(int i=1;i<=c;i++) printf("%d\n",a[i]);
}

Measured memory_bytes: 1536
#include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>
#include <complex>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }

typedef long long ll;
typedef double D;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }





int main() {
	int a, b;
	
	cin >> a >> b;
	while (1) {
		
		bool flag = false;
		for_(i, a, b+1) {
			if (i%100==0) {
				if (i%400==0) {
					cout << i << endl;
					flag = true;
				}
			} else if (i%4==0) {
				cout << i << endl;
				flag = true;
			}
		}
		if (!flag) cout << "NA" << endl;
		
		cin >> a >> b;
		if (a==0 && b==0) break;
		else cout << endl;
	}
	
	return 0;
}

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

using namespace std;
int dp[(1<<22)+3],a[30][30],n,mod=1e9+7;
int fun(int mask)
{
    int idx=0;
    for (int i=0;i<n;i++)
    {
        if ((mask&(1<<i))>0) idx++;
    }
    if (idx==n)
    {
        return 1;
    }
    if (dp[mask]>-1) return dp[mask];
    int ret=0;
    for (int i=0;i<n;i++)
    {
        if (a[idx][i]==0 || (mask&(1<<i))>0) continue;
        ret=(ret+fun(mask|(1<<i)))%mod;
    }
    dp[mask]=ret;
    return ret;
}
int main()
{
    cin>>n;
    memset(dp,-1,sizeof(dp));
    for (int i=0;i<n;i++)
    {
        for (int j=0;j<n;j++)
        {
            cin>>a[i][j];
        }
    }
    cout<<fun(0);
    return 0;
}


Measured memory_bytes: 16640
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int[] nums=new int[n];
        int[] dp=new int[n];
        for(int i=0;i<n;i++){
            nums[i]=sc.nextInt();
        }
        dp[1]=Math.abs(nums[1]-nums[0]);
        for(int i=2;i<n;i++){
            dp[i]=Math.min(dp[i-1]+Math.abs(nums[i]-nums[i-1]),dp[i-2]+Math.abs(nums[i]-nums[i-2]));
        }
        System.out.println(dp[n-1]);

    }
}

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

int check(int k){
  int ret=0;
  while(true){
    if(k==0){
      return ret;
    }
    ret+=k%10;
    k/=10;
  }
}
int main(){
  int N, A, B; cin >> N >> A >> B;
  int ans=0;
  for(int i=1;i<=N;i++){
    if(check(i)>=A && check(i)<=B){
      ans+=i;
    }
  }
  cout << ans << endl;
}
           
          

Measured memory_bytes: 256
#include<iostream>
#include<map>
using namespace std;
int main(void){
  string moji;
  cin >> moji;
  map<char,int> data;
  for (int i = 0; i < (int)moji.size();i++){
    data[moji[i]]++;
  }
  for (int i = 0; i < (int)moji.size();i++){
    if(data[moji[i]]%2==0)
      continue;
    else
    {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
import math
import sys
#####sorting a dictionary by the values#####
def dict_sort(ans):
    ans=sorted(ans.items(),reverse=True,key=lambda kv:(kv[1]))
##### naive method for testing prime or not#####
def is_prime(n):
    if n==1:
        return 0
    for i in range(2,int(math.sqrt(n))+1):
        if n%i==0:
            return False
    return True
#####greatest common divisor of two numbers#####
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
#####least common multiplyer of two numbers#####
def lcm(a,b):
    return (a*b)//gcd(a,b)
#####function that return all the letters#####
def alphbates():
    return "abcdefghijklmnopqrstuvwxyz"
#####binary search#####
def binary_search(ls,n,flag):
    low=0
    hi=n-1
    while(low<=hi):
        mid=(low+hi)//2
        if ls[mid]==flag:
            return mid
        elif ls[mid]>flag:
            hi=mid-1
        else:
            low=mid+1
    return -1
#####taking an array/list as input#####
def inp():
    ls=list(map(int,input().split()))
    return ls
#####taking multiple inputs#####
def mult_inp():
    return map(int,input().split())
#####Main function starts from here#####
s=input()
ls=[]
k=0
for i in range(len(s)):
    if s[i]=='S':
        ls.append(k)
        k=0
    else:
        k+=1
ls.append(k)
print(max(ls))

Measured memory_bytes: 9084
#include<vector>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <cmath>
#include<queue>
#include <sstream>
#include <set>

const long long INF = 10000000000007;
using namespace std;
typedef long long llong;

//int isalpha(char ch): ch がアルファベットなら true を返す
//int isdigit(char ch): ch が数字なら true を返す
//int islower(char ch): ch が小文字なら true を返す
//int isupper(char ch): ch が大文字なら true を返す
//int tolower(char ch): ch の小文字を返す
//int toupper(char ch): ch の大文字を返す

//string型
//size()	文字数を返す
//Insert()	（指定した場所に）文字・文字列を挿入する
//erase()	（指定した場所の）文字・文字列を削除する
//clear()	すべての文字を削除する
//substr()	文字列の（指定した）部分文字列を返す
//replace()	（指定した）部分文字列を新しい文字列に置換する
//c_str()変換
//文字列の比較は、<=や==などを使え
//replace関数を使い、簡単に文字列を置換
//リバース関数：reverse(str.begin(), str.end());
//map<type, type> dict;で宣言
//グラフ理論用変数
//vector<vector<llong> > graph(N);

//ソート
//降順sort(v.begin(), v.end(), std::greater<Type>());

//大文字から小文字へんかん
//w[i] = w[i]-'A'+'a';

//vector
//assignメソッド　引数：サイズ、値
//与えられたサイズと値でvectorを初期化する

//queueクラス
//find()次に取り出す値の表示をする。
//pop()値を取り出す。戻り値はなし
//push()キューに値をプッシュする

//priority_queueクラス

//切り上げ
//ceil
//floor

int main(){
    llong N,M;
    cin >> N >> M;
    vector<pair<llong, llong> > ANS_TABLE(M);
    vector<vector<llong> > TABLE(N);
    pair<llong, llong> X;
    map<llong, llong> dict;
    map<llong, llong> dict2;
    for(int i=0; i<M; i++){
        cin >> X.second >> X.first;
        TABLE[X.second-1].push_back(X.first);
        dict[X.first] = X.second;
        dict2[X.first] = i;
    }

    for(int i=0; i<N; i++){
        sort(TABLE[i].begin(), TABLE[i].end());
    }

    for(int i=0; i<N; i++){
        for(int j=0; j<TABLE[i].size(); j++){
            ANS_TABLE[dict2[TABLE[i][j]]].first = dict[TABLE[i][j]];
            ANS_TABLE[dict2[TABLE[i][j]]].second = j+1;
        }
    }

    for(int i=0; i<M; i++){
        printf("%06lld%06lld\n", ANS_TABLE[i].first, ANS_TABLE[i].second);
    }
    return 0;
}


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

int main()
{
	int n,a,b,A,B;
	while(cin >> n, n)
	{
		A=B=0;
		while(n--)
		{
			cin >> a >> b;
			if(a< b) {B+=a+b;}
			if(a> b) {A+=a+b;}
			if(a==b) {A+=a;B+=b;}
		}
		cout << A << " " << B << endl;
	}
}

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
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; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }

int a[26];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    string s; cin >> s;
    rep(i, s.size()) a[s[i]-'a']++;
    rep(i, 26) if (!a[i]) {cout << char('a'+i) << endl; return 0;}
    cout << "None" << endl;
    return 0;
}

Measured memory_bytes: 512
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, Q = MAP()
nodes = [[] for i in range(N)]
for i in range(N-1):
    a, b = MAP()
    nodes[a-1].append(b-1)

ans = [0] * N
for i in range(Q):
    p, x = MAP()
    ans[p-1] += x

def dfs(u, prev, cnt):
    ans[u] += cnt
    for v in nodes[u]:
        if v != prev:
            dfs(v, u, ans[u])
dfs(0, -1, 0)

print(*ans)


Measured memory_bytes: 224560