akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <queue>
#include <set>
#include <bitset>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<int, int> qii;
typedef pair<int, int> pii;

#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repz(i,n) rep(i,0,n)

//int型を受け取ってその桁数を返す
int check_digits(int n) {
	int digits = 0;
	while (n != 0) {
		n /= 10;
		digits++;
	}
	return digits;
}

//int型を受け取ってその各桁の和を返す
int sum_digits(int n) {
	int sum=0;
	int N = n;
	while (N) {
		sum += N % 10;
		N /= 10;
	}
	return sum;
}


//最大公約数を返す関数
int gcd(int n, int m) {
	while (n != 0) {
		if (n < m) swap(n, m);
		n = n % m;
	}
	return m;
}


//2点間の距離を返す
float dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2));
}


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


	system("pause");
	return 0;
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = (a); i <= (b); ++i)
#define per(i, a, b) for(int i = (a); i >= (b); --i)
#define debug(x) cerr << #x << ' ' << x << endl;
using namespace std;

typedef long long ll;
const int mod = 1e9+7;
const int MAXN = 2e5 + 7;
const double EPS=1e-9;
inline int sign(double a){return a<-EPS?-1:a>EPS;}
inline int cmp(double a,double b){return sign(a-b);}
//点
struct P{
    double x,y;
    P(){}
    P(double _x,double _y):x(_x),y(_y){}
    P operator + (P p){return P(x+p.x,y+p.y);}
    P operator - (P p){return P(x-p.x,y-p.y);}
    P operator * (double k){return P(x*k,y*k);}
    P operator / (double k){return P(x/k,y/k);}
    double dot(P p){return x*p.x+y*p.y;}
    double det(P p){return x*p.y-y*p.x;}
    double distTo(P p){return (*this-p).abs();}
    double alpha(){return atan2(y,x);}
    void read(){scanf("%lf%lf", &x, &y);}
    void write(){printf("%.10lf %.10lf\n", x, y);}
    double abs(){return sqrt(abs2());}
    double abs2(){return x*x+y*y;}
    P rot90(){return P(-y,x);}
    P unit(){return *this/abs();}
    int quad(){return sign(y)==1||(sign(y)==0&&sign(x)>=0);}
    P rot(double an){return P(x*cos(an)-y*sin(an),x*sin(an)+y*cos(an));}
    bool operator < (P p)const{int c=cmp(x,p.x);if(c)return c==-1;return cmp(y,p.y)==-1;}
    bool operator == (P o)const{return cmp(x,o.x)==0&&cmp(y,o.y)==0;}
};

int main(int argc, char const *argv[])
{
    P p1, p2, p, x;
    p1.read(); p2.read();
    int q;
    scanf("%d", &q);
    while (q--) {
        p.read();
        double k1 = (p-p1).dot(p2-p1);
        double k2 = (p2-p1).abs();
        k1 /= k2;
        x = (p2 - p1) * k1/k2;
        (p + (x+p1-p)*2).write();
    }
    return 0;
}


Measured memory_bytes: 3240
r1 = [int(str) for str in input().split()]
r2 = [int(str) for str in input().split()]
r3 = [int(str) for str in input().split()]
n = int(input())

for i in range(n):
  b = int(input())
  r1 = [0 if x == b else x for x in r1]
  r2 = [0 if x == b else x for x in r2]
  r3 = [0 if x == b else x for x in r3]

c1 = [r1[0],r2[0],r3[0]]
c2 = [r1[1],r2[1],r3[1]]
c3 = [r1[2],r2[2],r3[2]]
s1 = [r1[0],r2[1],r3[2]]
s2 = [r1[2],r2[1],r3[0]]

s = [sum(r1),sum(r2),sum(r3),sum(c1),sum(c2),sum(c3),sum(s1),sum(s2)]

if 0 in s:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
//By Don4ick 
//#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;

#define forn(i, n) for (int i = 1; i <= n; i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define y1 qewr1234

const double PI = acos(-1.0);
const int DIR = 4;
const int X[] = {1, 0, -1, 0};
const int Y[] = {0, 1, 0, -1};

const int N = (int)1e5 + 228;
const int MOD = (int)1e9 + 7;

using namespace std;

int n;
ll a, b, s[N], t[N << 1], dp[N];

void upd(int v, ll val)
{	
	v += n - 1;
	t[v] = (t[v] + val) % MOD;
	while(v > 1)
	{
		v >>= 1;
		t[v] = (t[v << 1] + t[v << 1 | 1]) % MOD;
	}
}

ll get(int l, int r)
{
	l += n - 1, r += n - 1;
	ll res = 0;
	while(l <= r)
	{
		if (l & 1)
			res = (res + t[l++]) % MOD;
		if (!(r & 1))
			res = (res + t[r--]) % MOD;
		l >>= 1, r >>= 1;
	}
	return res;
}

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

	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

	//~read
	scanf("%d%lld%lld", &n, &a, &b);
	forn(i, n)
		scanf("%lld", &s[i]);	
	if (a < b)
		swap(a, b);
	//~solve
	sort(s + 1, s + n + 1);
	int ptr1 = 1, ptr2 = 0;
	stack < pair < ll, int > > st;
	forn(i, n)
	{
		if (ptr1 == 1)
			dp[i] = 1;		
		while(ptr2 < i - 1 && s[ptr2 + 1] <= s[i] - a)
			ptr2++;
		if (max(1, ptr1 - 1) <= ptr2)
			dp[i] = (dp[i] + get(max(1, ptr1 - 1), ptr2)) % MOD;
		if (i == 1 || i == n || s[i + 1] - s[i - 1]	>= b)
			upd(i, dp[i]);
		if (i > 1 && s[i - 1] > s[i] - b)
			ptr1 = i;
	}
	ll ans = 0;
	for (int i = n; i >= 1; i--)
	{
		if (i < n - 1 && s[i + 2] - s[i + 1] < b)
			break;
		if (i == 1 || i == n || s[i + 1] - s[i - 1] >= b)
			ans = (ans + dp[i]) % MOD;
	}       
	bool good = true;
	for (int i = 2; i <= n; i++)
		if (s[i] - s[i - 1] < b)
			good = false;
	cout << ans + good << endl;

	return 0;
}



Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define sc(x) scanf("%d", &x)
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define ALL(x) x.begin(), x.end()
#define SZ(x) ((int)x.size())
#define sqr(x) ((x)*(x))
#define ABS(x) ((x)>=0?(x):(-(x)))
#define fastio ios::sync_with_stdio(0),cin.tie(0)
template<class T>T gcd(T a, T b){return b?gcd(b, a%b):a;}

int main()
{
    int n, k;
    sc(n); sc(k);
    if(n%k)printf("1\n");
    else printf("0\n");
    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
#define int ll
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
 
int mod=1e9+7;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename A,typename B> istream& operator>>(istream&,pair<A,B>&);
template<typename A> istream& operator>>(istream&,vector<A>&);
void add(int&,int);
int mul(int,int);
int powz(int,int);

template<typename A> ostream& operator<<(ostream&,vector<A>&);
 
const int N=1000002;

void solve(){
	int a;
	cin>>a;
	string s;
	cin>>s;
	if(a>=3200)cout<<s;
	else cout<<"red";
		
		
}

 
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	//~ cin>>tc;
	for(int _=0;_<tc;_++){
		//~ cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}
 
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)res=mul(res,a);
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
	    output<<i<<' ';
	return output;
}


Measured memory_bytes: 256
s = input()
if s =="SUN":
  print("7")
if s =="MON":
  print("6")
if s =="TUE":
  print("5")
if s =="WED":
  print("4")
if s =="THU":
  print("3")
if s =="FRI":
  print("2")
if s =="SAT":
  print("1")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long

using namespace std;

int d(vector<int> switches, vector<vector<int>> conn_list, vector<int> cond) {
  int r = 0;

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

  // cout << endl;

  for (int i = 0; i < conn_list.size(); i++) {
    int on_num = 0;
    for (int j = 0; j < conn_list[i].size(); j++) {
      int index = conn_list[i][j] - 1;

      if (switches[index]) {
        on_num++;
      }
    }
    if (on_num % 2 == cond[i]) {
      r++;
    }
  }

  // cout << r << endl;

  if (r == conn_list.size()) {
    return 1;
  }
  return 0;
}

int main() {
  int snum, lnum;
  scanf("%d %d", &snum, &lnum);

  vector<vector<int>> conn_list(lnum);

  for (int i = 0; i < lnum; i++) {
    int k;
    scanf("%d", &k);

    vector<int> conn(k);
    for (int i = 0; i < k; i++) {
      scanf("%d", &conn[i]);
    }

    conn_list[i] = conn;
  }

  vector<int> cond(lnum);
  for (int i = 0; i < lnum; i++) {
    scanf("%d", &cond[i]);
  }

  int count = 0;
  vector<int> switches(snum);
  for (;;) {
    if (d(switches, conn_list, cond)) {
      count += 1;
    }

    int end = 0;
    switches[0]++;

    for (int j = 0; j < switches.size(); j++) {
      if (switches[j] == 2) {
        if (j == switches.size() - 1) {
          end = 1;
          break;
        }
        switches[j + 1]++;
        switches[j] = 0;
      }
    }

    if (end) {
      break;
    }
  }

  cout << count << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;
using TextReader = System.IO.TextReader;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var s = consoleReader.String;
            if (s[0] != 'A') return "WA";
            if (char.IsUpper(s[1])) return "WA";
            if (char.IsUpper(s.Last())) return "WA";
            var x = s.Skip(2).Where(c => char.IsUpper(c)).ToArray();
            if (x.Length != 1 || x[0] != 'C') return "WA";
            return "AC";
        }

        #region いつもの
        private readonly ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader(Console.In)).Calc()); static string AllLines<T>(IEnumerable<T> source) => string.Join("\n", source);
        #endregion
    }

#pragma warning disable
    public class ConsoleReader
    {
        private string[] line = Array.Empty<string>();
        private int linePosition;
        private TextReader textReader;
        public ConsoleReader(TextReader tr) { textReader = tr; }
        public int Int => int.Parse(String);
        public long Long => long.Parse(String);
        public double Double => double.Parse(String);
        public string String
        {
            get
            {
                if (linePosition >= line.Length)
                {
                    linePosition = 0;
                    line = textReader.ReadLine().Split();
                }
                return line[linePosition++];
            }
        }
        public class SplitLine
        {
            private string[] splited;
            public SplitLine(ConsoleReader cr) { splited = cr.textReader.ReadLine().Split(); }
            public int[] Int => String.Select(x => int.Parse(x)).ToArray();
            public long[] Long => String.Select(x => long.Parse(x)).ToArray();
            public double[] Double => String.Select(x => double.Parse(x)).ToArray();
            public string[] String => splited;
        }
        public SplitLine Split => new SplitLine(this);
        public class RepeatReader
        {
            ConsoleReader cr; int count;
            public RepeatReader(ConsoleReader cr, int count) { this.cr = cr; this.count = count; }
            public IEnumerable<T> Select<T>(Func<ConsoleReader, T> func) { for (int i = 0; i < count; i++) yield return func(cr); }
            public IEnumerable<string> String { get { for (int i = 0; i < count; i++) yield return cr.String; } }
            public IEnumerable<int> Int { get { for (int i = 0; i < count; i++) yield return cr.Int; } }
            public IEnumerable<double> Double { get { for (int i = 0; i < count; i++) yield return cr.Double; } }
        }
        public RepeatReader Repeat(int count) => new RepeatReader(this, count);
    }
}

Measured memory_bytes: 13396
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;

const int MX = 100005;

int main(){
	int n;
	cin >> n;
	vector<int> cnt(MX);
	for(int i=0;i<n;i++){
		int a;
		cin >> a;
		cnt[a]++;
	}
	ll tot = 0;
	for(int i=0;i<MX;i++){
		tot += i*cnt[i];
	}
	int q;
	cin >> q;
	for(int i=0;i<q;i++){
		int b,c;
		cin >> b >> c;
		tot -= b*cnt[b];
		tot -= c*cnt[c];
		cnt[c] += cnt[b]; cnt[b] = 0;
		tot += b*cnt[b];
		tot += c*cnt[c];
		cout << tot << endl;
	}
	return 0;
}


Measured memory_bytes: 3276
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>

using namespace std;

int main()
{
	int a, b;
	scanf("%d%d", &a, &b);
	if(a%2==0 || b%2==0) printf("No\n");
	else printf("Yes\n");
	return 0;
}

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

void solve(){
      int a,b;
      cin>>a>>b;
      cout<<(((a*(a-1))/2)+((b*(b-1))/2));
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    solve();
    return 0;
}

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

class Program
{
  static void Main() => new Program().solve();

  void solve()
  {
    var n = int.Parse(ReadLine());
    var a = ReadLine().Split(' ').Select(int.Parse).ToList();

    var map = new Dictionary<int, int>(n);
    a.ForEach(ai => {
      if(map.ContainsKey(ai)) map[ai]++;
      else map.Add(ai, 1);
    });

    var ans = map.Where(e => e.Key != e.Value)
      .Aggregate(0, (acc, e) =>
        (e.Value > e.Key) ? acc + e.Value - e.Key : acc + e.Value);

    WriteLine(ans);
  }
}

Measured memory_bytes: 26588
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 16:16:15 2020

@author: shinba
"""
import sys

s = list(input())

if s[0] != "A":
    print("WA")
    sys.exit()
else:
    s = s[1:]

t = s[1:len(s)-1]

if t.count("C") != 1:
    print("WA")
    sys.exit()
else:
    t.remove("C")

t.append(s[-1])
t.insert(0,s[0])

if "".join(t) == "".join(t).lower():
    print("AC")
else:
    print("WA")


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

bool isprime[100001];

void eratos(int n){
  
  for(int i=0 ; i <= n ; i++){
    isprime[i]=true;    
  }
  isprime[0]=isprime[1]=false;
  for(int i=2 ; i <= sqrt(n) ; i++){
    if(isprime[i]){
      int  j=i+i;
      while(j <= n){
	isprime[j]=false;
	j=j+i;
      }
    }
  }
}
int main(){

  eratos(100000);
  
  int m,a,b;
  
  while(1){

    cin >>m>>a>>b;
    if(m==0 && a==0 && b==0)break;

    for(int i = m ; i > 0 ; i--){
      bool flag=false;
      for(int j = 1 ; j <= sqrt(i) ; j++){
	if(i%j != 0)continue;
	if(isprime[j] == 0 || isprime[i/j] == 0)continue;
	if((double)a/b > (double)j/(i/j) || (double)j/(i/j) > 1)continue;
	cout <<j<<" "<<i/j<<endl;
	flag=true;
	break;
      }
      if(flag)break;
    }
    
    
  }
  
  return 0;
}

Measured memory_bytes: 1256
if __name__ == "__main__":
    N = int(input())
    if (N == 1):
        print (1)
        exit()
    res = 1 << 50
    for x in range(1, N):
        if (x * x > N):
            break
        if (N % x == 0):
            a = len(str(x))
            b = len(str(N // x))
            res = min(res, max(a, b))
    print (res)


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

int main(){
    string t,s,u;
    i64 a,b;
    cin>>s>>t>>a>>b>>u;
    if(s==u) a--;
    else b--;
    cout<<a<<" "<<b<<endl;
    return 0;
}

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

int main()
{
    ll x,k,d;
    cin>>x>>k>>d;
    if (x == 0) {
        if (k%2) cout << d << '\n';
        else cout << 0 << '\n';
        return 0;
    }
    x = abs(x);
    ll a = x % d;
    ll b = x / d;
    if (b >= k) cout << x - d*k << '\n';
    else {
        ll c = k - b;
        if (c % 2) {
            cout << d - a << '\n';
        }
        else cout << a << '\n';
    }
    return 0;
    
}

Measured memory_bytes: 3636
n = int(input())
a = list(map(int,input().split()))
l = []
aaa = 0
for i in a:
    if i<400:
        l.append("hai")
    elif i<800:
        l.append("tya")
    elif i<1200:
        l.append("midori")
    elif i<1600:
        l.append("mizu")
    elif i<2000:
        l.append("ao")
    elif i<2400:
        l.append("ki")
    elif i<2800:
        l.append("dai")
    elif i<3200:
        l.append("aka")
    else:
        aaa+=1
x = len(set(l))
print(max(1,x),x+aaa)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <map>
#include <vector>

using namespace std;

#define MAXN 100000

int h[MAXN + 1], s[MAXN + 1][2];
std::vector <int> g[MAXN + 1];

bool clica;
long long ans;

void dfs(int x) {
    s[x][0] = 1;
    for (auto &y : g[x]) {
        if (h[y] == 0) {
            h[y] = h[x] + 1;
            dfs(y);
            s[x][0] += s[y][1];
            s[x][1] += s[y][0];
        } else if (h[y] % 2 == h[x] % 2)
            clica = 1;
    }
}

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

    for (int i = 1; i <= m; i++) {
        int x, y;
        cin >> x >> y;

        g[x].push_back(y);
        g[y].push_back(x);
    }

    h[1] = 1;
    dfs(1);

    if (clica) ans = 1LL * n * (n - 1) / 2;
    else ans = 1LL * s[1][0] * s[1][1];

    cout << ans - m;

    return 0;
}


Measured memory_bytes: 7296
/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_4_D
  * Computation - Min, Max and Sum
  */
object Main {
  def main(args: Array[String]): Unit = {
    val n = io.StdIn.readInt()
    val seq = io.StdIn.readLine().split(" ").map(_.toLong).toSeq
    println(s"${seq.min} ${seq.max} ${seq.sum}")
  }
}

Measured memory_bytes: 49956
/*input
10 6
1000000000 1000000000 1000000000 1000000000 1000000000 0 0 0 0 0




*/

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

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 100001
#define M 1000000007
#define ll long long
#define vll vector<long long>
#define vi vector<int>
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<long long,long long> >
#define pb push_back
#define pf pop_front
#define mp make_pair
#define F first
#define S second


ll power(ll a,ll m,ll mod){
	ll ans=1;
	while(m){
		if(m%2){
			ans*=a;
			ans%=(mod);
		}
		a=(a*a)%(mod);
		m>>=1;
	}
	return ans;
}


void init(long long* a,long long n,long long val){
	for(long long i=0;i<n;i++)
		a[i]=val;
}



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);	
	ll t=1,i,j;
	ll n,kt;
	cin>>n>>kt;
	ll a[n];
	rep(i,0,n){
		cin>>a[i];
	}
	sort(a,a+n);
	reverse(a,a+n);
	ll ans=0;
	ll fact[n+1],inv[n+1];
	fact[0]=1;
	inv[0]=1;
	rep(i,1,n+1){
		fact[i]=i*fact[i-1];
		fact[i]%=M;
		inv[i]=power(fact[i],M-2,M);
	}
	rep(i,0,n){
		ll k=a[i];
		k+=M;
		k%=M;
		if(n-i-1>=kt-1){
			k*=fact[n-i-1];
			k%=M;
			k*=inv[kt-1];
			k%=M;
			k*=inv[n-i-kt];
			k%=M;
			ans+=k;
			ans%=M;
		}
		k=a[i];
		k+=M;
		k%=M;
		//cout<<ans<<endl;
		if(i>=kt-1){
			k*=fact[i];
			k%=M;
			
			k*=inv[kt-1];
			k%=M;
			k*=inv[i-kt+1];
			k%=M;
			//cout<<inv[3]<<endl;
			ans-=k;
			ans%=M;
			ans+=M;
			ans%=M;
			//cout<<k<<endl;
		}
		//cout<<ans<<endl;

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




Measured memory_bytes: 2560
#include<stdio.h>
#include<string.h>

int main(){
	char s[1000];
	int n;
	scanf("%d",&n);
	getchar();
	int x=0;
	int max=0;
	scanf("%s",&s);
	for(int i=0;i<strlen(s);i++){
		if(s[i]=='I'){
			x++;
			if(x>max){
				max=x;
			}
		}
		if(s[i]=='D'){
			x--;
		}
	}
	printf("%d",max);
}

Measured memory_bytes: 128
N=int(input(""))

total=0
total2=0
total3=0
total4=0

for i in range(0,N):
      A = str(input(""))
      if A=="AC":
            total=total+1
      elif A=="WA":
            total2=total2+1      
      elif A=="TLE":
            total3=total3+1
      else:
            total4=total4+1

print("AC x",total,)
print("WA x",total2,)
print("TLE x",total3,)
print("RE x",total4,)




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

typedef long long ll;
#define MAX 100005


int main(){
  ll  N;
  int h[MAX];
  int cost[MAX];
  scanf("%lld", &N);
  for(ll i=0;i<N;i++){
    int k;
    scanf("%d", &k);
    h[i] = k;
  }

  cost[0] = 0;
  cost[1] = abs(h[1]-h[0]);
  for(ll i=2;i<N;i++){
    cost[i] = min(abs(h[i]-h[i-2])+cost[i-2], abs(h[i]-h[i-1])+cost[i-1]);
  }
  cout << cost[N-1];
  return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a); i < (b); ++i)
#define rrep(i,a,b) for(int i = (b); i --> (a);)
#define all(v) (v).begin(),(v).end()
#define trav(x,v) for(auto &x : v)
#define sz(v) int(v.size())
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

int main(){
	cin.sync_with_stdio(0);
	cin.tie(0);
	cin.exceptions(cin.failbit);

	int n;
	cin >> n;

	cout << 360 / __gcd(n, 360) << endl;
}


Measured memory_bytes: 3636
#ifndef CLASS_MODINT
#define CLASS_MODINT

#include <cstdint>

template <std::uint32_t mod>
class modint {
private:
	std::uint32_t n;
public:
	modint() : n(0) {};
	modint(std::int64_t n_) : n((n_ >= 0 ? n_ : mod - (-n_) % mod) % mod) {};
	static constexpr std::uint32_t get_mod() { return mod; }
	std::uint32_t get() const { return n; }
	bool operator==(const modint& m) const { return n == m.n; }
	bool operator!=(const modint& m) const { return n != m.n; }
	modint& operator+=(const modint& m) { n += m.n; n = (n < mod ? n : n - mod); return *this; }
	modint& operator-=(const modint& m) { n += mod - m.n; n = (n < mod ? n : n - mod); return *this; }
	modint& operator*=(const modint& m) { n = std::uint64_t(n) * m.n % mod; return *this; }
	modint operator+(const modint& m) const { return modint(*this) += m; }
	modint operator-(const modint& m) const { return modint(*this) -= m; }
	modint operator*(const modint& m) const { return modint(*this) *= m; }
	modint inv() const { return (*this).pow(mod - 2); }
	modint pow(std::uint64_t b) const {
		modint ans = 1, m = modint(*this);
		while (b) {
			if (b & 1) ans *= m;
			m *= m;
			b >>= 1;
		}
		return ans;
	}
};

#endif // CLASS_MODINT

#include <vector>
#include <iostream>
using namespace std;
const int mod = 1000003;
using mint = modint<mod>;
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	vector<mint> fact(mod);
	fact[0] = 1;
	for (int i = 1; i < mod; ++i) {
		fact[i] = fact[i - 1] * i;
	}
	int Q;
	cin >> Q;
	while (Q--) {
		int X, D, N;
		cin >> X >> D >> N;
		if (D == 0) {
			cout << mint(X).pow(N).get() << '\n';
		}
		else {
			mint R = mint(X) * mint(D).inv();
			cout << (X == 0 || R.get() + N > mod ? 0 : (fact[R.get() + N - 1] * fact[R.get() - 1].inv() * mint(D).pow(N)).get()) << '\n';
		}
	}
	return 0;
}

Measured memory_bytes: 4864
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <set>
#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(), (x).end()
#define FILL(v, value) (v+(sizeof(v) / sizeof *(v)), value);
#define inf 999999999
#define dbg(x) cout<<#x<<":"<<x<<endl;
#define pb(a) push_back((a))
#define mp(a) make_pair((a))
#define sz(x) (int)(x).size()
#define pi 2*acos(0.0)
#define in scanf
#define out printf
#define fi first
#define se second
#define bit(n) (1LL<<(n))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;

const int MOD=1000000007; // 10^9 + 7
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};  // right, down, left, up

string moji = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
int main(int argc, char**argv){
	int n;
	while(1){
		cin >> n;
		if (n == 0) break;
		vi k;
		rep(i, n){
			int tmp;
			cin >> tmp;
			k.pb(tmp);
		}
		string s;
		cin >> s;

		rep(i, sz(s)){
			int ix = moji.find(s[i]);
			// dbg((ix - k[i % sz(k)]) % sz(moji));
			s[i] = moji[(ix - k[i % sz(k)] + sz(moji)) % sz(moji)];
		}
		cout << s << endl;

	}

	return 0;
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    string S,T; cin >> S >> T;
    REP(i,S.size()){
        T = T[T.size()-1] + T.substr(0,T.size()-1);
        if(S == T){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <numeric>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1e9+7
#define pb push_back
#define MP make_pair
typedef long long int ll;
typedef std::pair<int,int> P;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;
int main() {
    int n,m;
    while(cin>>n>>m){
        if(!n&&!m)return 0;
        vector<int> v(101,0);
        rep(i,0,n){
            int x,va; cin>>x>>va;
            v[x]=max(v[x],va);
        }
    cout<<accumulate(all(v),0)<<endl;
    }
    
    return 0;
}



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

#define endl '\n'
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define vvi vector<vi>
#define add push_back
#define MAXN 200005

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

    int s, w;
    cin >> s >> w;
    cout << (w>=s?"unsafe":"safe") << endl;

    return 0;
}



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

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
        #define eprintf(...) 42
#endif

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

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

/*
*/

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

  vi cnt(m, 0);
  rep(i, n){
    int k;
    cin >> k;
    
    rep(j, k){
      int a;
      cin >> a;
      cnt[--a]++;
    }
  }

  int ans = 0;
  rep(i, m){
    if(cnt[i] == n) ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define testing 1
#define FOR(i,s,e) for(ll i = s; i <= (ll)e; ++i)
#define DEC(i,s,e) for(ll i = s; i >= (ll)e; --i)
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define db(x) cerr << #x << "=" << x << "\n"
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << "\n"
#define db3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<"\n"
#define dbv(v) cerr << #v << ":"; for (auto ite : v) cerr << ite << ' '; cerr <<"\n"
#define dbvp(v) cerr << #v << ":"; for (auto ite : v) cerr << "{"  << ite.f << ',' << ite.s << "} "; cerr << "\n"
#define dba(a,ss,ee) cerr << #a << ":"; FOR(ite,ss,ee) cerr << a[ite] << ' '; cerr << "\n"
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long 
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define reach cerr << "LINE: " << __LINE__ << "\n";
typedef pair <ll, ll> pi;
typedef tuple<ll,ll,ll> ti3;
typedef tuple<ll,ll,ll,ll>ti4;
string cts(char x) {string t(1,x); return t;}
ll rand(ll a, ll b) { return a + rng() % (b-a+1); }
const int MOD = 1e9 + 7;
const int inf = (int)1e9 + 500;
const long long oo = (ll)1e18 + 500;
template <typename T> void chmax(T& a, T b) { a = max(a, b); }
template <typename T> void chmin(T& a, T b) { a = min(a, b); }
const int MAXN = -1;
#if !testing
#define cerr if(0)cout
#endif
vector<ti4>query;
int n,m,Q;
int ans = 0;
vector<int>v;
void solve() {
	//db(v.size());
	if((int)v.size() == n) {
		int cur = 0;
		for(auto q:query) {
			if(v[get<1>(q)]-v[get<0>(q)]==get<2>(q))cur+=get<3>(q);
		}
		chmax(ans,cur);
		return;
	}
	int lb = v.size() ? v.back() : 1;
	FOR(i,lb,m) {
		v.pb(i);
		solve();
		v.pop_back();
	}
}
	
int32_t main() 
{
	IAMSPEED
	cin >> n >> m >> Q;
	while(Q--) {
		int a,b,c,d; cin>>a>>b>>c>>d;
		--a,--b;
		query.pb(tie(a,b,c,d));
	}
	solve();
	cout<<ans;
}



Measured memory_bytes: 3552
#include<bits/stdc++.h>
#define inf 1000000000000000000ll
using namespace std;
long long a=1ll,b[5000005];
int main(){
	int n,f=1;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
	scanf("%lld",&b[i]);if(b[i]==0){
		cout<<0;
		return 0;
	}}
	sort(b+1,b+n+1);
	for(int i=1;i<=n;i++){
		if(1000000000000000000ll/a<b[i]){
			cout<<-1;
	    	return 0;
	    }
	    else{
	    	a*=b[i];
		}
	}
	printf("%lld",a);
	return 0;
}

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


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
 
    string s;
    cin>>s;
    int n = s.size();
    for(int i=0;i<n;i++){
        cout << "x";
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
using namespace std;

int main () {
  string s, h;
  cin >> s >> h;
  for (int i = 0; i < s.size(); i++) {
    cout << s[i];
    if (i < h.size()) {
    cout << h[i];
    }
  }
  cout << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		String[] s = saori.nextHayami().split("");
		int ans = 0;
		int num = 0;
		for(int i = 0;i < n;i++){
			if(s[i].equals("I")){
				num++;
			}
			if(s[i].equals("D")){
				num--;
			}
			ans = Math.max(ans, num);
		}
		System.out.println(ans);

		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 20436
N = gets.to_i
A = N.times.map { gets.to_i }

tdp = Array.new(N + 1, 0)

win_counter = Hash.new(0)
children = Hash.new { |h, k| h[k] = [] }
parent = Hash.new
checked = Hash.new(false)

A.each.with_index(2) do |a, i|
  win_counter[a] += 1
  children[a] << i
  parent[i] = a
end

queue = []

(2..N).each do |id|
  next if win_counter[id] > 0

  checked[id] = true

  queue << parent[id]
end

queue.uniq!

until queue.empty?
  id = queue.shift

  next unless children[id].all? { |eid| checked[eid] }

  list = children[id].sort_by { |cid| -tdp[cid] }

  v = list.map.with_index(1) { |id, i| tdp[id] + i }.max
  tdp[id] = v

  checked[id] = true
  queue << parent[id] if parent[id]
end

puts tdp[1]


Measured memory_bytes: 37684
def narrow_rectangles_easy(W: int, a: int, b: int) -> int:
    if a + W < b:
        return b - (a + W)
    if b + W < a:
        return a - (b + W)
    return 0


if __name__ == "__main__":
    W, a, b = map(int, input().split())
    ans = narrow_rectangles_easy(W, a, b)
    print(ans)


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

int main() {
  int x, a, b;
  cin >> x >> a >> b;
  cout << (abs(x-a) < abs(x-b) ? "A" : "B") << endl;
  return 0;
}


Measured memory_bytes: 256
/*
                                                  __          __
      /\   |   |     /\   |  | |  |     /\   | / |  )   /\   |  )
     /__\  |   |    /__\  |--| |  |    /__\  |<  |-<   /__\  |-<
    /    \ |__ |__ /    \ |  | \__/   /    \ | \ |__) /    \ |  \

*/

#import<bits/stdc++.h>
typedef long long ll;
#define num 100010
#define forll(i,a,b,c) for(int i=a; i<=b; i+=c)
#define forll2(i,a,b,c) for(int i=a; i>=b; i-=c)
#define pb(n) push_back(n)

using namespace std;

int main()
{
    string a,b;
    cin>>a>>b;
    int n=0;
    forll(i,0,a.size()-1,1)
    {
        if(a[i]!=b[i]){n++;}
    }
    cout<<n<<"\n";
}


Measured memory_bytes: 3856
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=105;
struct node
{
    int x,y;
    bool operator<(const node&o)const
    {
        return atan2(y,x)<atan2(o.y,o.x);
    }
}a[N<<1];
int n;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d%d",&a[i].x,&a[i].y);
    sort(a+1,a+1+n);
    for(int i=1;i<=n;i++) a[i+n]=a[i];
    double ans=0;
    for(int i=1;i<=n;i++)
    {
        ll x=0,y=0;
        for(int j=i;j<i+n;j++)
        {
            x+=a[j].x;y+=a[j].y;
            ans=max(ans,sqrt(x*x+y*y));
        }
    }
    printf("%.15f\n",ans);
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<string>

using namespace std;
typedef long long ll;

int main(void)
{
	int N;
	cin >> N;
	string str;
	cin >> str;

	int num = 1;
	char pre = str[0];
	
	for (int i = 1; i < str.size(); i++)
	{
		if (str[i] != pre)
		{
			num += 1;
			pre = str[i];
		}
	}

	cout << num << endl;
	return 0;
}

Measured memory_bytes: 512
INF = float('inf')


def trace_back(sink, predecessors):
    p = predecessors[sink]
    while p is not None:
        v, i = p
        yield edges[v][i]
        p = predecessors[v]


def min_cost_flow(source, sink, required_flow):
    res = 0
    while required_flow:
        dist = [INF] * n
        dist[source] = 0
        predecessors = [None] * n

        while True:
            updated = False
            for v in range(n):
                if dist[v] == INF:
                    continue
                for i, (remain, target, cost, _) in enumerate(edges[v]):
                    new_dist = dist[v] + cost
                    if remain and dist[target] > new_dist:
                        dist[target] = new_dist
                        predecessors[target] = (v, i)
                        updated = True
            if not updated:
                break

        if dist[sink] == INF:
            return -1

        aug = min(required_flow, min(e[0] for e in trace_back(sink, predecessors)))
        required_flow -= aug
        res += aug * dist[sink]
        for e in trace_back(sink, predecessors):
            remain, target, cost, idx = e
            e[0] -= aug
            edges[target][idx][0] += aug
    return res


n, m, f = map(int, input().split())
edges = [[] for _ in range(n)]

for _ in range(m):
    s, t, c, d = map(int, input().split())
    es, et = edges[s], edges[t]
    ls, lt = len(es), len(et)
    es.append([c, t, d, lt])
    et.append([0, s, -d, ls])

print(min_cost_flow(0, n - 1, f))

Measured memory_bytes: 7984
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
typedef long long ll;
const ll longinf=1LL<<60;
using namespace std;
struct node
{
    int num;
    ll c;
};
node a[200000];
bool cmp(node a,node b)
{
    return a.c<b.c;
}

int n,m;

int main()
{
    cin>> n >> m;
    for (int i=1; i<=n; ++i)
    {
        scanf("%lld%d",&a[i].c,&a[i].num);
    }
    sort(a+1,a+n+1,cmp);
    ll ans = 0;
    for (int i=1; i<=n; ++i)
    {
        int tmp=min(m,a[i].num);
        m-=tmp;
        ans+=tmp*a[i].c;
        if (!m) break;
    }
    cout<<ans<<endl;
        
    return 0;
}



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


void solve(long long N, long long sum,std::vector<long long> A){
    long long ans[N] = {0};
    long long tmp = 0;
    for(long long i = 1;i <= N -1; i+=2){
        tmp += A[i];
    }
    ans[0] = sum - 2 * tmp;
    cout << ans[0];
    for(long long i = 1; i < N;i++){
        ans[i] = 2 * A[i - 1] - ans[i - 1];
        cout << " " << ans[i];
    }
    cout << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    long long sum = 0;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
        sum += A[i];
    }
    solve(N,sum,std::move(A));
    return 0;
}


Measured memory_bytes: 2816
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        int ans = 8;
        int n = sc.nextInt();
        if (n >= 1800) {
            ans--;
        }
        if (n >= 1600) {
            ans--;
        }
        if (n >= 1400) {
            ans--;
        }
        if (n >= 1200) {
            ans--;
        }
        if (n >= 1000) {
            ans--;
        }
        if (n >= 800) {
            ans--;
        }
        if (n >= 600) {
            ans--;
        }
        System.out.println(ans);
    }
}

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

using namespace std;
typedef long long ll;
const int N = 1e5 + 5;
ll a[105][2], sol[105][N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, w;
    cin >> n >> w;
    for (int i = 1; i<=n; i++) {
        cin >> a[i][0] >> a[i][1];
    }


    for (int i = 1; i<=n; i++) {
        for (int j = 1; j<=w; j++) {
            if (a[i][0] <= j) {
                sol[i][j] = max(a[i][1] + sol[i-1][j-a[i][0]], sol[i-1][j]);
            }
            else {
                sol[i][j] = sol[i-1][j];
            }
        }
    }
    cout << sol[n][w] << endl;
    return 0;
}


Measured memory_bytes: 79360
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;

int main() {
	long long a, b, x;
	cin >> a >> b >> x;
	cout << (a == 0 ? b / x + 1 : (b / x + 1) - ((a-1)/ x+1)) << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      while(sc.hasNext()) {
         String[] input = sc.nextLine().split(",");
         int num = Integer.parseInt(input[0]);
         double weight = Double.parseDouble(input[1]);
         double height = Double.parseDouble(input[2]);
         double bmi = weight/(height*height);
         if(bmi >= 25.0) {
            System.out.println(num);
         }
      }
   }
}


Measured memory_bytes: 25972
#include <stdio.h>

int main()
{
  double N;
  double a=0;
  double b;
  int i;
  
  scanf("%lf", &N);

  for(i=1; i<=N; i++){
    if(i%2==1){
      a=a+1.0;
    }
  }
  b=a/N;
  printf("%f\n", b);
  
  return 0;
}
    

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define modulo 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9

int food[31];

int main() {
	int N, M;
	cin >> N >> M;
	for (int i = 1; i <= 30; i++) food[i] = 0;
	for (int i = 0; i < N; i++) {
		int K; cin >> K;
		for (int j = 0; j < K; j++) {
			int a;
			cin >> a;
			food[a]++;
		}
	}

	int ans = 0;
	for (int i = 1; i <= M; i++) {
		if (food[i] == N) ans++;
	}
	cout << ans << endl;

	return 0;
}

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

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

#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, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/02/24  Problem: code-festival-2016-qual-c_c / Link: https://code-festival-2016-qualc.contest.atcoder.jp/tasks/codefestival_2016_qualC_c?lang=en  ----- */
/* ------問題------

アルピニストである高橋君と青木君は最近ある有名な山脈を踏破しました。この山脈はN 個の山からなっており、西から東に向けて山1,山2,…,山Nと一直線に並んでいます。高橋君は西から、青木君は東からこの山脈を踏破しました。
山i の高さはhi ですが、二人とも各hi の値は忘れてしまいました。その代わり、各i(1≦i≦N) に対して、山i の山頂にたどり着いた時の、それまでに登った山(山i も含む)の高さの最大値を記録しています。 高橋君の記録した値はTi で、青木君の記録した値はAi です。
各山の高さhi が正の整数であることはわかっています。山の高さの列としてありうるものが何通りあるかを109+7 で割ったあまりを求めてください。
ただし記録が間違っていてありうる山の高さの列が存在しないこともあります。この場合は0を出力してください。

-----問題ここまで----- */
/* -----解説等-----

これ昔全くわからなかった
まず不正を検出する。
値が変化するときに着目すればよく、両側から変化するときは一致する
片側のみ変化の際はもう片方よりも大きくはならない(一緒か反対側にもっと大きいものが存在するはず)
これに反するものがあれば不正となる。
不正がない状態では、小さい方の値だけ組合せが存在する。

----解説ここまで---- */

LL N;

LL ans = 0LL;

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

	cin >> N;
	VL a(N);
	VL t(N);
	FOR(i, 0, N) {
		cin >> t[i];
	}
	FOR(i, 0, N) {
		cin >> a[i];
	}
	ans = 1;
	if (t.back() != a.front())ans = 0;
	FOR(i, 1, N-1) {
		if (t[i] != t[i - 1] && a[i] != a[i + 1]) {
			if (t[i] != a[i]) {
				ans = 0;
			}
		}
		else if (t[i] != t[i - 1]) {
			if (t[i] > a[i]) {
				ans = 0;
			}
		}
		else if (a[i] != a[i + 1]) {
			if (a[i] > t[i]) {
				ans = 0;
			}
		}
		else {
			ans *= min(a[i], t[i]);
			ans %= MOD;
		}
	}



	cout << ans << "\n";

	return 0;
}


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

#define ll long long
#define ld long double
#define pb push_back
#define pi  pair<int,int>
#define pl  pair<ll,ll>

int const N=1e5+5;
ll min(ll x,ll y) { if(x<y) return x; else return y; }
ll max(ll x,ll y) { if(x>y) return x; else return y; }

ll n,l;
vector<ll>v(105),w(105);
ll dp[105][N];

ll sol(ll i,ll val)
{
    if(val<0) return 1e15;
    if(i>=n) {
        if(val==0) return 0;
        else return 1e15;

    }

    if(dp[i][val]!=-1) return dp[i][val];
    return dp[i][val]=min(w[i]+sol(i+1,val-v[i]),sol(i+1,val));




}

int main()
{
    ll i,a;
    cin>>n>>l;

    memset(dp,-1,sizeof(dp));
    for(i=0;i<n;i++) {
        cin>>w[i]>>v[i];
    }

    ll ans=0;
    for(i=1;i<=1e5;i++)
    {
        ll temp=sol(0,i);
        if(temp<=l) ans=i;
    }

    cout<<ans<<endl;



}


Measured memory_bytes: 82304
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<stdio.h>
using namespace std;
int main(){
    int a;
    cin>>a;
    int ans=0;
    int mx=0;
    for(int i=1;i<=sqrt(a);i++){
        if(i==1){ans=1;}
        else{
        int q=2;
        int ansa=pow(i,q);
            int flag=0;
        while(a>=ansa){
            q++;
            ansa=pow(i,q);
            flag=1;
        }
            if(flag==1){
                int u=pow(i,q-1);
                ans=max(ans,u);
                
            }else{break;}
        }
    }
    cout<<ans<<endl;
    
    
    
return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int N, M;
    scanf("%d %d", &N, &M);
    
    int minNum = 1;
    int maxNum = N;
    for(int i = 0;i < M;++i){
        int L,R;
        scanf("%d %d", &L, &R);
        
        minNum = max(L, minNum);
        maxNum = min(R, maxNum);
    }
    
    if(minNum <= maxNum){
        cout << (maxNum - minNum + 1);
    }else{
        cout << 0;
    }
}


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

int main(){
  long long i,N,K;
  cin >> N >> K;
  long long diff, ans=0;
  for(i=K; i<N+2; i++){
    diff = (N+1-i)*i;
    ans += diff+1;
    ans = ans%mod;
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 3644