akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;

int binpow(int a, int b) {
    if (b == 0)
        return 1;
    int res = binpow(a, b / 2);
    if (b % 2)
        return res * res * a;
    else
        return res * res;
}

ll gcd(ll a,ll b)
{
    if (b==0) return a;
    return gcd(b,a%b);
}
string to_upper(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
    return a;
}
 
string to_lower(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
    return a;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,k=0;
    string s;
    cin>>s;
    n=sz(s);
    for (int i=0;i<n;++i)
    {
        if (s[i]!=s[n-1-i])
        {
            ++k;
        }
    }
    cout<<k/2;
    return 0;
}

Measured memory_bytes: 256
/**
 * 	author: krayr
 * 	created: 19.05.2019
**/

#include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back
#define mp make_pair
#define forn(i, s, n) for(int i = s; i < int(n); i++)

typedef long long ll;
//~ const double pi = 2*acos(0.0);
//~ const long long mod = 1e9+7;
//~ const int MAX_N = 1e6+5;

int main(int argc, char* argv[]){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
       
    #ifdef _DEBUG
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif
    
	int a, b; cin >> a >> b;
	
	int x = max(a, b);
	
	int ans = max((x + (x-1)), (a+b));
	
	cout << ans << "\n";
    

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String a=sc.nextLine(),b=sc.nextLine();
    b = b.substring(0,a.length());
    if(a.equals(b)){
      pl("Yes");
    }else{
      pl("No");
    }
  }

  public static void pr(String str){
    System.out.print(str);
  }
  public static void pl(String str){
    System.out.println(str);
  }
}


Measured memory_bytes: 35812
#include <iostream>

using namespace std;

const int MAX_N = 4e5 + 10;
const int ZERO = 2e5 + 5;

int _cover [MAX_N];
int& cover (int x) {
  return _cover[ZERO + x];
}

int ans = 0;
int cnt [MAX_N];

void add (int x) {
  cnt[x]++;
  int pos = x - cnt[x] + 1;

  cover(pos)++;
  if (pos > 0 && cover(pos) == 1) ans++;
}

void del (int x) {
  int pos = x - cnt[x] + 1;
  cnt[x]--;

  cover(pos)--;
  if (pos > 0 && cover(pos) == 0) ans--;
}

int arr [MAX_N];

int main () {
  ios::sync_with_stdio(false);

  int n, m;
  cin >> n >> m;

  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    add(arr[i]);
  }

  for (int i = 0; i < m; i++) {
    int idx, val;
    cin >> idx >> val;

    del(arr[idx]);
    arr[idx] = val;
    add(arr[idx]);
    cout << n - ans << '\n';
  }
}


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


int main(){

  std::string s;
  std::cin>>s;
  
  int m=(s[5]-'0')*10+(s[6]-'0');
  int d=(s[8]-'0')*10+(s[9]-'0');

  if(m>4){
    std::cout<<"TBD"<<std::endl;
  }else if(m==4){
    if(d<=30){
      std::cout<<"Heisei"<<std::endl;
    }else{
      std::cout<<"TBD"<<std::endl;
    }
  }else{
    std::cout<<"Heisei"<<std::endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int                  long long int
#define ff                   first
#define ss                   second
#define pb                   push_back
#define mp                   make_pair
#define pii                  pair<int,int>
#define vi                   vector<int>
#define mi                   map<int,int>
#define pqb                  priority_queue<int>
#define pqs                  priority_queue<int,vi,greater<int>>
#define setbits(x)           __builtin_popcountll(x)
#define zrobits(x)           __builtin_ctzll(x)
#define mod                  1000000007
#define inf                  1e18
#define precise(x,y)         fixed<<setprecision(y)<<x
#define w(x)                 int x;cin>>x;while(x--)
#define endl                 "\n"
#define no_of_digit(n)       floor(log10(n))+1
#define copyarr(a,b,n)       copy_n(a,n,b)
mt19937                      rng(chrono::steady_clock::now().time_since_epoch().count());

//*******************to check if all number in array are positive*******************
//all_of(arr,arr+n,[](int x){return x>0;})?cout<<"positive":cout<<"some negative";


//*******************to check if any element in array is negative*******************
//any_of(arr,arr+n,[](int x){return x<0;})?cout<<"Any negative":cout<<"All positive";


int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //*****************Enter the code here*******************//
    int n,d;
    cin>>d>>n;
    int s=1;
    for(int i=0;i<d;i++)
    	s*=100;

    if(n<=99)
    	cout<<n*s<<endl;
    else
    	cout<<s*101<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define     ll          long long int
#define     REP(i,x,n)    for(ll i=x;i<n;i++)
#define     SZ(v)       (ll)v.size()
#define     endl        "\n"
#define     ff          first
#define     ss          second
#define     PQ_MIN      priority_queue <ll, vector<ll>, greater<ll> >
#define     PQ          priority_queue <int>
#define     pbds        tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define     setbit(x)   __builtin_popcount(x)
#define     prec(n)     fixed<<setprecision(n)
#define     pb(n)       push_back(n)
#define     mp(a,b)     make_pair(a,b)
#define     clr(n)      memset(n,0,sizeof(n))
#define     reset(n)    memset(n,-1,sizeof(n))
#define     ii          pair<ll,ll>
#define     vll         vector<ll>
using namespace std;
using namespace __gnu_pbds;
const ll INF=1e16;
const ll nxm=5e5+5;
ll a[nxm];
ll n,q;
ll ans[nxm];
ll fre[nxm];
const ll rnxm=800;
ll cnt=0;

struct node
{
    ll l,r,ind;
};
node query[nxm];

bool comp(node a,node b) {

if(a.l/rnxm==b.l/rnxm)
    return a.r<=b.r;
else
    return a.l/rnxm <=b.l/rnxm;
}

void add(ll val)
{
    fre[val]++;
    if(fre[val]==1)
        cnt++;
}
void remo(ll val)
{
    fre[val]--;
    if(fre[val]==0)
        cnt--;
}

void solve(){




cin>>n>>q;

REP(i,0,n) cin>>a[i];


REP(i,0,q)
{
        cin>>query[i].l>>query[i].r;
        query[i].l--;
        query[i].r--;
        query[i].ind=i;
}


sort(query,query+q,comp);

ll prevl=0,prevr=-1;

REP(i,0,q){


ll l=query[i].l,r=query[i].r;

while(l<prevl)
    prevl--,add(a[prevl]);

while(r>prevr)
    prevr++,add(a[prevr]);

while(prevl<l)
   remo(a[prevl]),prevl++;

while(prevr>r)
    remo(a[prevr]),prevr--;

ans[query[i].ind]=cnt;

}

REP(i,0,q) cout<<ans[i]<<endl;



}
int main(){
//    freopen("timber_input", "r", stdin);
//    freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll t=1;
//	cin>>t;
    REP(i,1,t+1)
    {
//    cout<<"Case #"<<i<<": ";
		solve();
    }
	return 0;
}


Measured memory_bytes: 27236
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int datanum = sc.nextInt();
        int dataroom[][][] = new int[3][10][4];
        int b,f,r,v;

        for(int i = 0; i < datanum; i++){
            b = sc.nextInt();
            f = sc.nextInt();
            r = sc.nextInt();
            v = sc.nextInt();
            dataroom[f-1][r-1][b-1] += v;
        }

        for(int i = 0; i < 4; i++ ){
            for(int m = 0; m < 3; m++ ){
                for(int n = 0; n < 10; n++){
                    System.out.print(" " + dataroom[m][n][i]);
                }
                System.out.println();
            }
            if( i != 3 ) System.out.println("####################");
        }
    }
}


Measured memory_bytes: 29428
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<string>
#define nl n<<1
#define nr (n<<1)  1
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int>P;
const int INF=0x3f3f3f3f;
const ll INFF=0x3f3f3f3f3f3f3f3f;
const double pi=acos(-1.0);
const double eps=1e-9;
const ll mod=1e9+7;
int main()
{
    int n;
    scanf("%d",&n);
    int ans=-1,keep=-1;
    for(int i=1;i<=n;i++)
    {
        int x=i;int num=0;
        while(x%2==0)
        {
            num++;
            x/=2;
        }
        if(num>ans)
        {
            ans=num;
            keep=i;
        }
    }
    printf("%d\n",keep);
    return 0;
}







//#include<bits/stdc++.h>
//using namespace std;
//typedef long long ll;
//char s1[30],s2[100010],s3[100010];
//int vis[205];
//int main()
//{
//    scanf("%s%s",s1,s2);
//    int l1=strlen(s2);
//    for(int i=0;i<strlen(s1);i++)vis[s1[i]]=1;
//    int q;scanf("%d",&q);
//    while(q--)
//    {
//        scanf("%s",s3);
//        int l2=strlen(s3);
//        if(l1-l2>1)
//        {
//            printf("NO\n");continue;
//        }
//    }
//    return 0;
//}


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

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

int main()
{
  int x, y;
  std::cin >> x >> y;
  std::cout << gcd( x, y ) << std::endl;
}



Measured memory_bytes: 3092
# include <iostream>
#include <algorithm>
#include <vector>
#include <map> // pair

using namespace std;

int N;
long long K;
const int MAX_N = 100000;
int a[MAX_N], b[MAX_N];

void solve(vector<pair<int, int> > pairs) {
	sort(pairs.begin(), pairs.end());
	int i = 0;
	while (K > 0) {
		K -= pairs[i].second;
		if (K <= 0) {
			break;
		}
		++i;
	}
	cout << pairs[i].first << endl;

}

int main() {
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> a[i] >> b[i];
	}
	vector<pair<int, int> > pairs(N);
	for (int i = 0; i < N; i++) {
		pairs[i] = make_pair(a[i], b[i]);
	}
	solve(pairs);
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
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; }


struct UnionFind {
    vector<int> data;

    UnionFind(int n) {
        data.resize(n);
        rep(i, n) data[i] = -1;
    }

    int root(int x) {
        if (data[x] < 0) return x;
        return data[x] = root(data[x]);
    }

    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return;
        if (data[x] > data[y]) swap(x, y);
        data[x] += data[y];
        data[y] = x;
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    int size(int x) {
        return -data[root(x)];
    }
};

int n;
int idx[200010], xy[200010], yx[200010];
int ans[200010];

int main() {
    cin >> n;
    rep(i, n) {
        int x, y; cin >> x >> y;
        x--; y--;
        idx[x] = i;
        xy[x] = y;
        yx[y] = x;
    }

    UnionFind uf(n);
    set<int> s;
    for (int x = 0; x < n; x++) {
        int t = xy[x];
        while (s.size() && xy[x] > *s.begin()) {
            uf.unite(idx[x], idx[yx[*s.begin()]]);
            chmin(t, *s.begin());
            s.erase(s.begin());
        }
        s.insert(t);
    }

    rep(i, n) cout << uf.size(i) << endl;
}


Measured memory_bytes: 11084
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#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 FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class ATOrT {
public:
    static constexpr int kStressIterations = 0;
    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int N, A, B;
        cin >> N >> A >> B;
        cout << min(N * A, B) << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    ATOrT solver;
    solver.solve(in, out);
    return 0;
}


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

using namespace std;


void maximal_value()
{
  int n;
  cin >> n;
  vector<int> b(n - 1);
  for (int i = 0; i < n - 1; ++i) cin >> b[i];

  vector<int> a(n);
  for (int i = 0; i < n; ++i)
  {
    if (i == 0)          a[i] = b[i];
    else if (i == n - 1) a[i] = b[i - 1];
    else                 a[i] = min(b[i - 1], b[i]);
  }

  cout << accumulate(a.begin(), a.end(), 0) << "\n";
}

int main()
{
  maximal_value();
}


Measured memory_bytes: 256
from collections import deque
def bfs(n,fordfs):
    l = [None] * n
    g = fordfs
    for i in range(n):
        if l[i] != None:
            #チェック済みの点iはスキップ
            continue
        l[i] = 0
        que = deque()
        que.append(i)
        while que:
            d = que.pop()
            for node, cost in g[d]:
                if l[node] == None:
                    l[node] = l[d] + cost
                    que.append(node)
                else:
                    if l[node] != l[d] + cost:
                        print('No')
                        exit(0)
    print('Yes')
#    print(l)
    return
##############################################################
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')

N, M = LI()
g = [[] for _ in range(N)]
for i in range(M):
    x,y,z = map(int,input().split())
#    l = min(x,y)
#    r = max(x,y)
    g[x-1].append((y-1, z))
    g[y-1].append((x-1, -z))

bfs(N,g)

Measured memory_bytes: 79008
#include <iostream>
#include <queue>

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

using namespace std;

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

int main(){
	long long int n,k;
	cin >> n >> k;
	
	bool overK = false;
	
//	queue<long long int> a;
//	long long int input, x, y;
	
	long long int a;
	cin >> a;
	if (a>=k) overK = true;
	long long int g = a;
	
	REP(i,n-1){
		cin >> a;
		if (a>=k) overK = true;
		g = gcd(g,a);
	}
	
	if (overK && k%g==0){
		cout << "POSSIBLE" << endl;
	}else{
		cout << "IMPOSSIBLE" << endl;
	}
	
	return 0;
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string s[2];
string::iterator p;
int fact();
int term();
int exp();
int k;
bool f[2];
 
int fact() {
  int x;string num;
  int mi=1;
  while(*p=='-') {
    mi*=-1;
    ++p;
  }
  while(isdigit(*p)){num+=*p;++p;}
  if(num.size()>1&&num[0]=='0') f[k]=0;
  if(num.size()) {
    x=0;
    for(int i=num.size()-1,j=0; i>=0; i--,j++) x+=(1<<j)*(num[i]=='1');
  } else if(p!=s[k].end()){
    if(*p!='(') f[k]=0;
    if(p!=s[k].end())++p;
    x=exp();
    if(*p!=')') f[k]=0;
    if(p!=s[k].end())++p;
  } else f[k]=0;
  return x*mi;
}
  
int term() {
  int x=fact();
  while(*p=='*') {
    ++p;
    x*=fact();
  }
  return x;
}
  
int exp() {
  int x=term();
  while(*p=='+'||*p=='-') {
    if(*p=='+') {
      ++p;
      x+=term();
    } else {
      ++p;
      x-=term();
    }
  }
  return x;
}
 
int main() {
  string r="01+-*()=";
  sort(r.begin(),r.end());
  string t;
  cin >> t;
  map<char,int> m;
  for(int i=0; i<t.size(); i++) {
    if(isalpha(t[i])&&!m.count(t[i])) {
      int x=m.size();
      m[t[i]]=x;
    }
  }
  if(m.size()>r.size()) {
    cout << 0 << endl;
    return 0;
  }
  set<string> se;
  do {
    string e=t;
    for(int i=0; i<e.size(); i++) {
      if(isalpha(e[i])) e[i]=r[m[e[i]]];
    }
    int c=0;
    for(int i=0; i<e.size(); i++) {
      if(e[i]=='=') c++;
    }
    if(c!=1) continue;
    c=0;
    s[0]=s[1]="";
    for(int i=0; i<e.size(); i++) {
      if(e[i]=='=') {
        c++;
        continue;
      }
      s[c]+=e[i];
    }
    if(!s[0].size()||!s[1].size()) continue;
    int x[2]={0,0};
    for(k=0; k<2; k++) {
      f[k]=1;
      p=s[k].begin();
      int d=0,z=0;
      for(int i=0; i<s[k].size(); i++) {
        if(isdigit(s[k][i])) z++;
        if(s[k][i]=='(') {
          d++;
          if(i&&(isdigit(s[k][i-1])||s[k][i-1]==')')) f[k]=0;
          if(i!=s[k].size()-1&&(!isdigit(s[k][i+1])&&s[k][i+1]!='('&&s[k][i+1]!='-')) f[k]=0;
        }
        if(s[k][i]==')') {
          d--;
          if(i&&(!isdigit(s[k][i-1])&&s[k][i-1]!=')')) f[k]=0;
          if(i!=s[k].size()-1&&isdigit(s[k][i+1])) f[k]=0;
        }
        if(i) {
          if(s[k][i]=='+'||s[k][i]=='*') {
            if(s[k][i-1]=='+'||s[k][i-1]=='*'||s[k][i-1]=='-') f[k]=0;
          }
        } else if(s[k][i]=='+'||s[k][i]=='*') f[k]=0;
        if(d<0) f[k]=0;
      }
      if(d||!z) f[k]=0;
      if(f[k]) x[k]=exp();
    }
    if(f[0]&&f[1]&&x[0]==x[1]) {
      se.insert(r.substr(0,m.size()));
    }
  } while(next_permutation(r.begin(),r.end()));
  cout << se.size() << endl;
  return 0;
}


Measured memory_bytes: 3236
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
  int n,k,m,x;
  cin>>n>>m;
  map<int,int> mp;
  rep(i,0,n){
    cin>>k;
    rep(j,0,k){
      cin>>x;
      mp[x]++;
    }
  }
  int ans=0;
  for(auto i:mp){
    if(i.s==n) ans++;
  }
  cout<<ans<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >
# define PQ priority_queue

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvs vector < vs >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

string vow = "aeiou";
int month[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

const int dx[] = { -1 , 0 , 1 , 0 } ;
const int dy[] = { 0 , 1 , 0 , -1 } ;

const ld pie = 3.1415926535897932384626 ;
const ll mod = 1e9 + 7 ;

/// Tip : If a and b are positive integers ; we may say - ceil (a/b) = 1 + floor ( (a-1)/b ) .

void solve ( int test_case )
{
    int n ;
    cin >> n ;

    vi v ( n ) ;
    for ( int i=0 ; i < n ; i ++ )
        cin >> v[i] ;

    sort ( all ( v ) ) ;

    ll ans = v[n - 1] ;
    int to_sit = n - 2 ;

    for ( int i = n - 2 ; i > -1 && to_sit > 0 ; i -- )
    {
        ans += v[i] ;
        to_sit -- ;

        if ( to_sit == 0 )
            break ;

        ans += v[i];
        to_sit -- ;
    }

    cout << ans ; line ;
}

int main()
{fast
    int t = 1;
    // cin >> t;

    for ( int i = 1 ; i <= t ; i ++ )
    {
        solve ( i ) ;
    }

    return 0;
}


Measured memory_bytes: 3992
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<valarray>//なんとなく追加
//メモ：表示桁数を大きくする　　cout << fixed << setprecision(20) << cm << endl;
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--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#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の二つ目の要素
#define pause system("pause")
#define PI acos(-1.0)


signed main() {
	string S, arc="ARC", abc = "ABC";

	cin >> S;
	if (S == arc) {
		cout << abc << endl;
	}
	else {
		cout << arc << endl;
	}
	pause;
}

Measured memory_bytes: 3624
import sys

l, r = [int(i) for i in input().split()]

ans = 2020
for i in range(l, r+1):
	for k in range(i+1, r+1):
		mod = (i * k) % 2019
		if mod==0:
			print(0)
			sys.exit()

		ans = min(mod, ans)
 
print(ans)

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


int main(){
    ll h,w;
    cin >> h >> w;
    ll a[h][w];
    ll count=0;
    for(ll i=0;i<h;i++){
        for(ll j=0;j<w;j++){
            cin >> a[i][j];
            count+=a[i][j];
        }
    }
    ll res=0;
    vector<tuple<ll,ll,ll,ll>> ans;
    for(ll i=0;i<h;i++){
        if(i%2==0){
            for(ll j=0;j<w-1;j++){
                if(a[i][j]%2==1){
                    a[i][j+1]++;
                    res++;
                    ans.push_back(make_tuple(i,j,i,j+1));
                }
            }
            if(i!=h-1&&a[i][w-1]%2==1){
                a[i+1][w-1]++;
                res++;
                ans.push_back(make_tuple(i,w-1,i+1,w-1));
            }
        }
        else{
            for(ll j=w-1;j>0;j--){
                if(a[i][j]%2==1){
                    a[i][j-1]++;
                    res++;
                    ans.push_back(make_tuple(i,j,i,j-1));
                }
            }
            if(i!=h-1&&a[i][0]%2==1){
                a[i+1][0]++;
                res++;
                ans.push_back(make_tuple(i,0,i+1,0));
            }
        }
    }
    cout << res << endl;
    for(ll i=0;i<res;i++){
        cout << get<0>(ans[i])+1 << " " << get<1>(ans[i])+1 << " " << get<2>(ans[i])+1 << " " << get<3>(ans[i])+1 << endl;
    }
}


Measured memory_bytes: 9412
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,pair<ll,ll> >
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ii>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a);  a = (a * a);  b/=2;  }  return res; }
#define rs resize
long long readLI(){  register char c;  for(c = getchar(); !(c>='0' && c<='9'); c = getchar());  register long long a=c-'0';
    for(c = getchar(); c>='0' && c<='9'; c = getchar())
        a = (a<<3)+(a<<1)+c-'0';
    return a;
}
const ll N = 200009;
ll n,k,i,a,ans;
ll fr[N];
set<ll> s;
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>n>>k;
    rep(i,0,n){
        cin>>a;
        fr[a]++;
        s.insert(a);
    }
    if(s.size() <= k) cout<<0;
    else{
        sort(fr,fr + N);
        rep(i,0,N) if(fr[i] > 0){
            ans += fr[i];
            s.erase(s.begin());
            if(s.size() == k) break;
        }
        cout<<ans;
    }
    return 0;
}

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


int main(){
  int n,m;
  int a,b;
  cin >> n >> m >> a >> b;
  int x[n];
  int y[m];
  int xmax;
  int ymin;
  int flag = 0;
  for(int i = 0;i < n; i++){
    cin >> x[i];
    if(i == 0){
      xmax = x[i]; 
    }else if(xmax < x[i]){
      xmax = x[i];
    }
  }
  for(int i = 0;i < m;i++){
    cin >> y[i];
    if(i == 0){
      ymin = y[i];
    }else if(ymin > y[i]){
      ymin = y[i];
    }
  }
  
  for(int i = -99; i < 101;i++){
    if(a < i && i <= b && xmax < i && ymin >= i){
      flag = 1;
      
      break;
    }
  }

  if(flag == 1){
    cout << "No War" << endl;
  }else{
    cout << "War" << endl;
  }
}


Measured memory_bytes: 256
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
// import java.math.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            PrintWriter ot=new PrintWriter(System.out);
            // int t=Integer.parseInt(br.readLine().trim());
            // // int total=0;
            // while(t-->0)
            // {
                
            // }
            String s=br.readLine().trim();
            if(s.charAt(s.length()-1)!='s')
            s+="s";
            else
            s+="es";
            ot.println(s);
            ot.close();
            br.close();
            
        } catch(Exception e){
            System.err.println("ERROR");
            return;
        }
    }
}
    

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

typedef long long ll;
ll _MOD = 1000000009;

struct union_find {
	vector<int> v;
	union_find(int n) : v(n, -1) {}
	int find(int x) { return (v[x] < 0) ? x : (v[x] = find(v[x])); }
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x != y) {
			if (-v[x] < -v[y]) swap(x, y);
			v[x] += v[y]; v[y] = x;
		}
	}
	bool same(int x, int y) { return find(x) == find(y); }
	int size(int x) { return -v[find(x)]; }
};

int main() {
	int n, m; cin >> n >> m;
	vector<int> a(m), b(m);
	for (int i = 0; i < m; i++) {
		scanf("%d%d", &a[i], &b[i]);
		a[i]--;
		b[i]--;
	}
	vector<bool> rm(n);
	for (;;) {
		vector<int> d(n);
		union_find uf(n);
		for (int i = 0; i < m; i++) {
			d[a[i]]++;
			d[b[i]]++;
			uf.unite(a[i], b[i]);
		}
		vector<vector<int> > v(n);
		for (int u = 0; u < n; u++) {
			if (rm[u]) continue;
			int p = uf.find(u);
			if (d[u] == uf.size(p) - 1)
				v[p].push_back(u);
		}
		bool updated = false;
		for (int p = 0; p < n; p++) {
			if (rm[p]) continue;
			if (uf.find(p) != p) continue;
			if (v[p].size() == uf.size(p)) continue;
			updated = true;
			for (int j = 0; j < v[p].size(); j++)
				rm[v[p][j]] = true;
		}
		if (!updated) {
			int x = 0, y = 1;
			for (int p = 0; p < n; p++) {
				if (rm[p]) continue;
				if (uf.find(p) != p) continue;
				x++;
				y = (ll)y * uf.size(p) % _MOD;
			}
			cout << x << endl << y << endl;
			return 0;
		}
		vector<int> _a, _b;
		for (int i = 0; i < m; i++)
			if (!rm[a[i]] && !rm[b[i]]) {
				_a.push_back(a[i]);
				_b.push_back(b[i]);
			}
		m = _a.size();
		a = _a;
		b = _b;
	}
}

Measured memory_bytes: 11892
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n,i,j;
  cin>>n;
  vector<int64_t> a(n+1);
  vector<vector<int64_t>> dp(n+1,vector<int64_t>(2));
  for(i=1;i<=n;i++) cin>>a.at(i);
  dp.at(1).at(0)=0;
  dp.at(1).at(1)=a.at(1);
  dp.at(2).at(0)=0;
  dp.at(2).at(1)=max(a.at(1),a.at(2));
  for(i=3;i<=n;i++){
    if(i%2==1) {
      dp.at(i).at(0)=max(dp.at(i-1).at(1),dp.at(i-2).at(0)+a.at(i));
      dp.at(i).at(1)=dp.at(i-2).at(1)+a.at(i);
    }
    else if(i%2==0) {
      dp.at(i).at(0)=max(dp.at(i-1).at(0),dp.at(i-2).at(0)+a.at(i));
      dp.at(i).at(1)=max(dp.at(i-1).at(1),dp.at(i-2).at(1)+a.at(i));
    }
  }
  if(n%2==0) cout<<dp.at(n).at(1)<<endl;
  else if(n%2==1) cout<<dp.at(n).at(0)<<endl;
}

Measured memory_bytes: 15604
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
	int a,b,c,k,s;
	while(cin>>a>>b)
	{
		k=a+b;
		s=0;
		while(k!=0)
		{
			k=k/10;
			s++;
		}
		cout<<s<<endl;
	}
	return 0;
}

Measured memory_bytes: 3020
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
#include <cctype>
using namespace std;

int main()
{
	char ch;
	int w_count[26] = {0};

	while(cin >> ch) {
		if(ch >= 'a' && ch  <= 'z')
			w_count[ch - 'a']++;
		else if(ch >= 'A' && ch <= 'Z')
			w_count[tolower(ch) - 'a']++;
	}
	for(int i = 0; i < 26; ++i) {
		cout << static_cast<char>('a' + i) << " : " << w_count[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1140
#include <cstdio>
#define C(X,Y) (P[X]*rP[Y]%mod*rP[(X)-(Y)]%mod)
const long long mod=1000000007ll;

int main()
{
  static long long v[1000000];
  v[1]=1;
  for(int i=2;i<1000000;i++){
    v[i]=(mod-mod/i)*v[mod%i]%mod;
  }
  static long long P[1000000],rP[1000000],P3[1000000],P2[1000000];
  P[0]=rP[0]=P3[0]=P2[0]=1ll;
  for(int i=1;i<1000000;i++){
    P[i]=P[i-1]*i%mod;
    rP[i]=rP[i-1]*v[i]%mod;
    P3[i]=P3[i-1]*3ll%mod;
    P2[i]=P2[i-1]*2ll%mod;
  }
  int N,M,K;
  scanf("%d%d%d",&N,&M,&K);
  long long ans=0ll;
  long long A=0,B=0;
  for(int i=0;i<=M+K;i++){
    if(i>M){
      A=(2*A+C(i-1,M))%mod;
    }
    if(i>K){
      B=(2*B+C(i-1,K))%mod;
    }
    long long T=(P2[i]+mod-A+mod-B)%mod;
    //printf("%d %lld %lld %lld\n",i,A,B,T);
    ans+=C(N-1+i,i)*T%mod*P3[M+K-i]%mod;
    ans%=mod;
  }
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 39168
#ifdef ConanYu
#include "local.hpp"
#else
#pragma GCC optimize("-O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void Main();
#define debug(...) do { } while (false)
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  Main(); return 0;
}
#endif

void Main() {
  ll n, a, b; cin >> n >> a >> b;
  ll res = n / (a + b) * a;
  res += min(n % (a + b), a);
  cout << res << "\n";
}

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

// コンテスト中のみ
//#define int long long

#define ll long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define P pair<ll,ll>
int MOD = 1000000007;
const ll INF = 1LL << 60;

string s, t;
int dp[1010][1010];

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> s >> t;
	int n = s.size(), m = t.size();
	rep(i, 1010)rep(j, 1010)dp[i][j] = 1001001001;
	dp[0][0] = 0;
	for (int i = -1; i < n; i++) {
		for (int j = -1; j < m; j++) {
			if (i == -1 && j == -1)continue;
			if (i >= 0 && j >= 0) {
				if (s[i] == t[j]) {
					dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j]);
				}
				else {
					dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j] + 1);
				}
			}
			if (i >= 0) {
				dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j + 1] + 1);
			}
			if (j >= 0) {
				dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i + 1][j] + 1);
			}
		}
	}
	cout << dp[n][m] << endl;
	return 0;
}


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

namespace abc152b{
    class Program{
        static void Main (string[] args){
            var inp = Console.ReadLine().Split().Select(s=>int.Parse(s)).ToArray();
            if(inp[0]>inp[1]){
                foreach(var a in Enumerable.Repeat(inp[1],inp[0]).ToList()){
                        Console.Write(a);
                }
            }
            else if(inp[1]>inp[0]){
                foreach(var a in Enumerable.Repeat(inp[0],inp[1]).ToList()){
                        Console.Write(a);
                }
            }
            else{
                foreach(var a in Enumerable.Repeat(inp[0],inp[0]).ToList()){
                        Console.Write(a);
                }
            }
        }
    }
}

Measured memory_bytes: 13396
/* 入力１

4
1 1 2
2 1 4
3 0
4 1 3

*/

/* 入力２

6
1 2 2 3
2 2 3 4
3 1 5
4 1 6
5 1 6
6 0

*/


#include<stdio.h>

#define WHITE 0
#define GRAY 1
#define BLACK 2

#define N 100

int n;
int M[N][N];
int color[N];
int d[N],f[N];
int time;

void dfs(int u);
void dfs_init(void);


int main(void){
  int i,j;
  int m,u,v;

  scanf("%d",&n);
  
  for(i = 0;i < n;i++){
    scanf("%d %d",&u,&m);
    u--;
    
    for(j = 0;j < m;j++){
      scanf("%d",&v);
      v--;
      M[u][v] = 1;
    }
  }

  dfs_init();

  return 0;
}
       







void dfs_init(void){
  int u;
  
  for(u = 0;u < n;u++){
    color[u] = WHITE;
  }
  
  time = 0;
  for(u = 0;u < n;u++){
    if(color[u] == WHITE){
      dfs(u);
    }
  }
  for(u = 0;u < n;u++){
    printf("%d %d %d\n",u+1,d[u],f[u]);
  }
  
}


void dfs(int u){
  int v;

  d[u] = ++time;
  color[u] = GRAY;
  
  for(v = 0;v < n;v++){
    if(M[u][v] == 0){
      continue;
    }
    if(color[v] == WHITE){
      dfs(v);
    } 
  }
  
  f[u] = ++time;
  color[u] = BLACK;
}



Measured memory_bytes: 2048
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int n;
    cin >> n;
    int s[n];
    rep(i,n)cin >> s[i];
    int sum = 0;
    rep(i,n)sum += s[i];
    if(sum%10!=0){
        cout << sum << endl;
        return 0;
    }
    sort(s,s+n);
    rep(i,n){
        int t = sum - s[i];
        if(t%10!=0){
            cout << t << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
}

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

typedef long long int ll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)

const ll MOD = 1000000007;

using namespace std;

int a[100005];

int LCM(int a, int b)
{
	if (a < b)
	{
		int temp = a;
		a = b;
		b = temp;
	}
	if (a%b == 0)
	{
		return b;
	}
	return LCM(b, a%b);
}

int main()
{
	int N, K;
	cin >> N >> K;
	REP(i, N)
	{
		cin >> a[i];
	}

	int lcm = a[0];
	REP(i, N)
	{
		lcm = LCM(lcm, a[i]);
	}

	REP(i, N)
	{
		if (a[i] - K >= 0 && (a[i] - K) % lcm == 0)
		{
			cout << "POSSIBLE" << endl;
			return 0;
		}
	}
	cout << "IMPOSSIBLE" << endl;
	return 0;
}

Measured memory_bytes: 640
const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.n())}return a}else{const a=t.input[0];t.input.shift();return Number(a)}},s:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.s())}return a}else{const a=t.input[0];t.input.shift();return String(a)}},c:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.c())}return a}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('')}else{t.input.shift()}return String(b)}},o:(...arg)=>{console.log(...arg)},abs:(a)=>{return Math.abs(a)},min:(...a)=>{return Math.min(...a)},max:(...a)=>{return Math.max(...a)},floor:(a)=>{return Math.floor(a)},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b})},desc:(ar:number[])=>{return ar.sort((a,b)=>{return b-a})},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]}};
const main=()=>{
  let n=t.n()
  let nr=t.n(n)
  let max=t.max(...nr)
  
  t.o(nr.reduce((t,d)=>{return t+d})-(max/2))
}
main()

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

#define FOR(i,a,b) for (int i = a; i < b; ++i)
#define FORR(i,a,b) for (int i = b - 1; i >= a; --i)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) FORR(i,0,n)

int main() {
	ll N, A, ans = 1;
	cin >> N;
	REP(i, N) {
		cin >> A;

		if (ans != -1) {
			if (1000000000000000000 / A >= ans) ans *= A;
			else ans = -1;
		}

		if (A == 0) {
			ans = 0;
			break;
		}
	}

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

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 2e5+5;
ll n,k;
int main(){
    cin>>n;
    string s = "";
    while(n){
        int tmp=n%26;
        if(tmp==0)tmp=26;
        s=char(tmp+96)+s;
        n=(n-tmp)/26;
    }
    cout<<s<<endl;
}


Measured memory_bytes: 3596
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	hs := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&hs[i])
	}

	cnt := 1
	max := hs[0]
	for i := 1; i < n; i++ {
		if hs[i] >= max {
			cnt++
			max = hs[i]
		}
	}
	fmt.Print(cnt)
}


Measured memory_bytes: 512
package main

import "fmt"

func max(a ...int) int {
	m := a[0]
	for i, v := range a {
		if i == 0 {
			continue
		}
		if m < v {
			m = v
		}
	}
	return m
}
func main() {
	// Code for B - Touitsu
	var N int
	var A, B, C string
	fmt.Scan(&N, &A, &B, &C)

	var ans int
	for i := 0; i < N; i++ {
		if A[i] == B[i] && B[i] == C[i] && C[i] == A[i] {
			continue
		} else if A[i] != B[i] && B[i] != C[i] && C[i] != A[i] {
			ans += 2
		} else {
			ans++
		}
	}
	fmt.Println(ans)

}


Measured memory_bytes: 1768
#!/usr/bin/env python3
import sys


def solve(T: int, X: int):
    print(T / X)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    T = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    solve(T, X)

if __name__ == '__main__':
    main()


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

using namespace std;

#define ll long long
#define fix cout << fixed; cout << setprecision(0)





void solve() {

	int m, n;
	cin >> m >> n;
	cout << (n * (n - 1)) / 2 + (m * (m - 1)) / 2 << "\n";
	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	fix;
	solve();

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;


class Main{

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int X = scan.nextInt();
		int A = scan.nextInt();
		int B = scan.nextInt();
		int ans = X-A;
		while(true){
			ans -= B;
			if(ans < 0){
				ans += B;
				break;				

			}
		}
		System.out.println(ans);





	}
}
class Pair implements Comparable{
	int from;
	int end;

	public Pair(int a,int b) {
		this.from = a;
		this.end = b;

	}
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}



Measured memory_bytes: 23124
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N, W;
    cin >> N >> W;
    int w[N];
    int v[N];
    for (int i = 0; i < N; i++) cin >> w[i] >> v[i];

    int dp[N+1][100001];
    fill(dp[0], dp[N+1], INF);
    dp[0][0] = 0;

    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= 100001; j++) {
            if (j - v[i] >= 0) {
                dp[i+1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i]);
            } else {
                dp[i+1][j] = dp[i][j];
            }
        }
    }

    int ret = -1;

    for (int j = 0; j < 100001; j++) {
        if (dp[N][j] <= W) ret = max(ret, j);
    }

    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 79104
package main

import (
	"fmt"
	"math"
	"strconv"
)

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

	minDiff := 1000000000
	for i := 0; i < len(s)-2; i++ {
		num, _ := strconv.Atoi(s[i : i+3])
		diff := AbsDiff(num, 753)
		if diff < minDiff {
			minDiff = diff
		}
	}
	fmt.Println(minDiff)
}

func AbsDiff(n1 int, n2 int) int {
	return int(math.Abs(float64(n1 - n2)))
}


Measured memory_bytes: 1772
#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
#define ll long long
#define ld long double
#define ms(a,v) memset(a,v,sizeof a)
#define pii pair<int, int>
/* * * *   * * *   	* * * */
/* *
 *
 * Author: Hamkor
 *
 * */
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n; cin>>n;
	int ans = 0, x=n;
	while(x){
		ans+=x%10;
		x/=10;
	}
	cout<<(n%ans? "No": "Yes"); 
    return 0;
}


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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var ds = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

        Array.Sort(ds);
        var m = ds.Length / 2;

        Console.WriteLine(ds[m] - ds[m - 1]);
    }
}


Measured memory_bytes: 18016
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<vector>
#include<set>
#include<sstream>
using namespace std;
typedef long long ll;
const ll maxn=1e6+10;
const ll inf=0x3f3f3f3f3f3f3f3f;
void io(){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
ll n,m;
ll a[maxn];
int main()
{
	io();
	double sum=0;
	cin>>n>>m;
	for(int i=0;i<n;i++)  cin>>a[i],sum+=a[i];
	double ans=1.0/(4*m);
	ll p=0;
	for(int i=0;i<n;i++)
	{
		double num=(double)a[i]/sum;
		if(num>=ans) p++;
	}
	if(p>=m) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 384
N,M,X=map(int,input().split())

a = [[0 for i2 in range(12)] for i1 in range(12)]
c=[0]*N
for i in range(N):
    C=list(map(int,input().split()))
    c[i]=C[0]
    for j in range(M):
        a[i][j]=C[j+1]

INF=1200001
ans=INF

for s in range(1<<N):
    cost = 0
    d = [0]*M
    for i in range(N):
        if(s>>i&1):
            cost+=c[i]
            for j in range(M):
                d[j]+=a[i][j];
    ok=1
    for j in range(M):
        if d[j]<X:
            ok=0
    if(ok):
        ans=min(ans,cost)
if(ans==INF):
    print(-1)
else:
    print(ans)


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#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 SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int H, W;
  cin >> H >> W;
  VS vs(H);
  REP(y,H) cin >> vs[y];

  VI cnt(26);
  REP(y,H) REP(x,W)
	cnt[vs[y][x]-'a']++;

  int n4 = 0, n2 = 0, n = 0;
  REP(c,26)
	if(cnt[c] % 4 == 0) ++n4;
	else if(cnt[c] % 2 == 0) ++n2;
	else ++n;
  
  if(H%2) swap(H,W);
  bool ok = true;
  if(H%2==1){ // od x od
	if(n > 1) ok = false;
	if(n == 1){
	  if(n2*2 > H+W-2) ok = false;
	}
	else if(n2*2-1 > H+W-2) ok = false;
  }
  else if(W%2 == 1){ // od x ev
	if(n) ok = false;
	if(n2*2 > H) ok = false;
  }
  else{ // ev x ev
	if(n + n2) ok = false;
  }
  cout << (ok? "Yes": "No") << endl;

  return 0;
}


Measured memory_bytes: 256
s=input()
f=int(s[:2])
b=int(s[2:])
if 0<= f <=99 and  1<= b <=12:
  if 1<= f <=12:
    print("AMBIGUOUS")
  else:
    print("YYMM")
elif 1<= f <= 12 and 0<= b <=99:
  if 1<= b <=12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:print("NA")


Measured memory_bytes: 3060