akhauriyash/Code-Regression huggingface dataset:
//bayemirov
#include <bits/stdc++.h>

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;

#define pb push_back

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	string s;
	cin >> s;
	int sum = 0;
	for (auto c : s) sum += (c - '0');
	cout << (sum % 9 == 0 ? "Yes" : "No");
   return 0;
}

Measured memory_bytes: 3748
#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<cmath>
#define ll long long
#define mp make_pair
#define pii pair<int,int>
#define fi first
#define se second
#define inf 0x7fffffff
#define llinf 0x7fffffffffffffffll
using namespace std;
int main()
{
	int i,j,k,n,m,x,y,z;
	scanf("%d%d%d",&x,&y,&z);
	scanf("%d",&n);
	ll ans=0;
	for(i=0;i<=x;i++)
	{
		for(j=0;j<=y;j++)
		{
			if(n-i*500-j*100>=0&&(n-i*500-j*100)/50<=z)
			{
				ans++;
			}
		}
	}
	printf("%lld",ans);
}

Measured memory_bytes: 256
def main():
    N, X = map(int, input().split())
    L = map(int, input().split())
    d = 0
    ans = 1
    for l in L:
        d += l
        if d <= X:
            ans += 1
        else:
            break
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 61840
Scanf.scanf "%d" (fun n ->
    let nei = Array.make n [] in
    for i = 1 to n - 1 do
        Scanf.scanf " %d %d" (fun a b ->
            let a = a - 1 in
            let b = b - 1 in
            nei.(a) <- b :: nei.(a);
            nei.(b) <- a :: nei.(b)
        )
    done;
    let c = Array.init n (fun _ -> Scanf.scanf " %d" (fun c -> c)) in
    Array.sort compare c;
    let m = Array.fold_left (+) 0 c - c.(n - 1) in
    Printf.printf "%d\n" m;

    let rec loop i mx mxv =
        if i = n then mxv else
            let l = List.length nei.(i) in
            if l > mx then loop (i + 1) l i else
                loop (i + 1) mx mxv
    in
    let mxv = loop 0 0 0 in

    let v = Array.make n 0 in
    let rec fill cur k =
        List.fold_left (fun k next ->
            if v.(next) = 0 then (v.(next) <- c.(k); fill next (k - 1)) else k) k nei.(cur)
    in
    v.(mxv) <- c.(n - 1);
    fill mxv (n - 2);
    Array.iter (Printf.printf "%d ") v;
    print_newline ()
)

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

void calcSum( int* a, int x, int y )
{
    int sum = 0;
    for( int i = x; i <= y; i++ )
            sum += a[i];
    cout << sum << endl;
}

int main()
{
    int a[100001] = {}, n, q, x, y;
    bool com;

    cin >> n >> q;
    for( int i = 0; i < q; i++ )
    {
        cin >> com >> x >> y;
        if( com == 1 )
            calcSum( a, x, y );
        if( com == 0 )
            a[x] += y;
    }

    return 0;
}



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

class Node {
    friend class List;
private:
    int num;
    Node *prev;
    Node *next;
public:
    Node(int n, Node *x, Node *y);
};

class List{
private:
    Node *head;
    Node *tail;
public:
    List();
    void Insert(int x);
    void Delete(int x);
    void deleteFirst();
    void deleteLast();
    void Print();
};

Node::Node(int n, Node *x, Node *y) {
  num = n;
  prev = x;
  next = y;
}

List::List() {
  head = NULL;
  tail = NULL;
}

void List::Insert(int x) {
  if(head == NULL) {
    head = new Node(x, NULL, head);
    tail = head;
    return;
  }
  Node *p = head;
  head = new Node(x, NULL, head);
  p->prev = head;
}

void List::Delete(int x) {
  Node *p;
  if(head == NULL)
    return;
  if(head->num == x) {
    deleteFirst();
    return;
  }

  for(p = head; p->num != x; p = p->next) {
    if(p->next == NULL)
      return;
  }
  if(p == tail) {
    deleteLast();
    return;
  }
  p->next->prev = p->prev;
  p->prev->next = p->next;
  delete p;
}

void List::deleteFirst() {
  Node *p = head;
  if(head == tail) {
    head = NULL;
    tail = NULL;
  }
  else
    head = head->next;
  delete p;
}

void List::deleteLast() {
  Node *p = tail;
  if(tail == head){
    head = NULL;
    tail = NULL;
  }
  else {
    tail = tail->prev;
    tail->next = NULL;
  }
  delete p;
}

void List::Print() {
  for(Node *p = head; p != NULL; p=p->next) {
    if(p != head)
      printf(" ");
    printf("%d", p->num);
  }
  printf("\n");
}

int main() {
  List l;
  int n, num;
  char command[20];

  scanf("%d", &n);
  for(int i = 0; i < n; i++) {
    scanf("%s", command);
    if(command[0] == 'i') {
      scanf("%d", &num);
      l.Insert(num);
    }
    else if(command[0] == 'd') {
      if (command[6] == 'F')
        l.deleteFirst();
      else if (command[6] == 'L')
        l.deleteLast();
      else {
        scanf("%d", &num);
        l.Delete(num);
      }
    }
  }
  l.Print();

  return 0;
}

Measured memory_bytes: 34388
def binarytrees():
    def set_depth(node_id):
        if tree[node_id]['parent'] == -1:
            return 0
        else:
            return set_depth(tree[node_id]['parent']) + 1

    def set_height(node_id):
        if not tree[node_id]['degree']:
            return 0
        else:
            return max(set_height(tree[node_id]['children'][0]),
                set_height(tree[node_id]['children'][1])) + 1

    n = int(input())

    tree = [{'parent': -1, 'sibling': -1, 'degree': 0, 'depth': 0, 'height': 0,
             'node_type': 'leaf', 'children': []} for i in range(n)]

    for i in range(n):
        line = list(map(int, input().split()))
        node_id = line[0]
        child1 = line[1]
        child2 = line[2]

        for child in [child1, child2]:
            if child != -1:
                tree[node_id]['children'] = line[1:]
                tree[child]['parent'] = node_id
                tree[node_id]['degree'] += 1

        if (child1 != -1) and (child2 != -1):
            tree[child1]['sibling'] = child2
            tree[child2]['sibling'] = child1

        if tree[node_id]['degree']:
            tree[node_id]['node_type'] = 'internal node'

    for node_id in range(n):
        tree[node_id]['depth'] = set_depth(node_id)
        tree[node_id]['height'] = set_height(node_id)

        if tree[node_id]['parent'] == -1:
            tree[node_id]['node_type'] = 'root'

    for node_id in range(n):
        parent = tree[node_id]['parent']
        sibling = tree[node_id]['sibling']
        degree = tree[node_id]['degree']
        depth = tree[node_id]['depth']
        height = tree[node_id]['height']
        node_type = tree[node_id]['node_type']

        print('node {}: parent = {}, sibling = {}, degree = {}, depth = {}, height = {}, {}'
            .format(node_id, parent, sibling, degree, depth, height, node_type))

if __name__ == '__main__':
    binarytrees()

Measured memory_bytes: 7852
#include <stdio.h>
int main(){
	int a, b, c, d;
	scanf("%d%d%d%d", &a, &b, &c, &d);
	if(a>=c){
		if(a>=d)printf("0\n");
		else{
			if(b<=d)printf("%d\n",b-a);
			else printf("%d\n", d-a);
		}
	}
	else{
		if(b<=c)printf("0\n");
		else{
			if(b<=d)printf("%d\n",b-c);
			else printf("%d\n", d-c);
		}
	}
	return 0;
}

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

int main() {
    int n,k;
    double ans,hit;
    int point;

    cin >> n >> k;
    ans = 0.0;
    for (int i=1;i<=n;i++){
        hit = 1/((double) n);
        point = i;
        while (point < k) {
            point *= 2;
            hit /= 2.0;
        }
        ans += hit;
    }
    cout << std::setprecision(12) << ans << endl;
    
}

Measured memory_bytes: 256
#include<cstdio>
#define MIN(a,b) (a)<(b)?(a):(b)
long long n,m,k,c,t,ans;
signed main(){scanf("%lld%lld%lld%lld",&n,&m,&k,&c),n--;while(n--){scanf("%lld",&t),ans+=MIN((t-c)*m,k),c=t;}return printf("%lld\n",ans),0;}

Measured memory_bytes: 128
N, M = map(int, input().split())
A = list(map(int, input().split()))
D = []
for i in range(M):
    b, c = map(int, input().split())
    D.append((b, c))
A = sorted(A)
D = sorted(D, key=lambda x: x[1], reverse=True)

i = 0
for j in range(M):
    p, q = D[j]
    while p > 0:
        if i < N and q > A[i]:
            A[i] = q
            i += 1
        else:
            print(sum(A))
            exit()
        p -= 1
print(sum(A))


Measured memory_bytes: 23340
import sys
sys.setrecursionlimit(10**7)
N,M=map(int,input().split())
G=[[] for i in range(N)]
for i in range(M):
  a,b=map(int,input().split())
  a-=1
  b-=1
  G[a].append(b)
  G[b].append(a)
color=[-1]*N  
def dfs(x):
  for i in G[x]:
    if color[i]==-1:
      color[i]=1^color[x]
      dfs(i)
    elif color[i]==color[x]:
      print((N*(N-1))//2-M)
      exit()
color[0]=0
dfs(0)
b=0
for i in range(N):
  b+=color[i]
print(b*(N-b)-M)
      
     
      

Measured memory_bytes: 211020
#include<stdio.h>
#include<stdlib.h>
#include<stdlib.h>

#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))

int main(void){
    unsigned long long int a,b,lcm,min,x,r;
    long c,d;
    scanf("%llu %llu %ld %ld",&a,&b,&c,&d);
    min = MIN(c,d);
    x = MAX(c,d);
    while(min != 0){
        r = x;
        r %= min;
        if(min>r){x=min;min=r;}
        else x=r;
    }
    lcm = (c/x) * d;
    unsigned long long ans = 0;
    a--;
    ans += b - (b/c + b/d - b/lcm);
    ans -= a -(a/c + a/d - a/lcm);
    printf("%llu",ans);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
#define df 0
#define f(a) ((a)/2*2)

int main(){
  if(df) printf("*debug mode*\n");
  long int I, O, T, J, L, S, Z ; cin >>I >>O >>T >>J >>L >>S >>Z; 
  long int s=O;
  s+=f(I)+f(J)+f(L);
  long int s1=O+3;
  if(I && J && L){
    I--;J--;L--;
    s1+=f(I)+f(J)+f(L);
  }else s1=s;
  printf("%ld",max(s,s1));
}

/// confirm df==0 ///


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
const int mod = 1e9 + 7;
const int INF = 1e9;
using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    sort(a,a+n);
    int ans = INF;
    for(int i = a[0]; i <= a[n-1]; ++i){
        int tmp = 0;
        for(int j = 0; j < n; ++j){
            tmp += ((a[j] - i) * (a[j] - i));
        } 
        ans = min(ans,tmp);
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

int main()
{
  char a[3];
  int count=0,c1=0;
  FASTIO;
  cin>>a;
  for(int i=0;i<sizeof(a);i++)
  {
   if(a[i]=='R')
   {
    if(a[i+1]=='R'||a[i-1]=='R')
    {
      count++;
    }
    else
    {
     c1++;
    }
   }
  }
 if(count>0)
  {
  cout<<count;
  }
 else if(c1>0)
  {
   cout<<"1";
  }
 else
  {
   cout<<"0";
  }
return 0;
}

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

int main(){
  int D; cin>>D;
  if(D==22)
    cout<<"Christmas Eve Eve Eve"<<endl;
  if(D==23)
    cout<<"Christmas Eve Eve"<<endl;
  if(D==24)
    cout<<"Christmas Eve"<<endl;
  if(D==25)
    cout<<"Christmas"<<endl;
}

Measured memory_bytes: 256
S = input()
index = len(S)

ansB = True

while True:
    if index == 0:
        break
    elif index < 0:
        ansB = False
        break

    if S[index - 5: index] == 'dream' or S[index - 5: index] == 'erase':
        index -= 5
    elif S[index - 6: index] == 'eraser':
        index -= 6
    elif S[index - 7: index] == 'dreamer':
        index -= 7
    else:
        ansB = False
        break

if ansB:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var N = consoleReader.Int32();
            var s = consoleReader.String();

            var counts = s.ToLookup(c => c).Select(l => l.Count());

            long res = 1;
            foreach (var c in counts)
            {
                res *= (c + 1);
                res = res % mod;
            }

            return --res;
        }

        const int mod = 1000000007;
        private readonly ConsoleReader consoleReader;
        public Program() : this(new ConsoleReader()) { }
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program().Calc());
    }

    public class ConsoleReader
    {
        public virtual string String() => Console.ReadLine();
        public int Int32() => int.Parse(String());
        public long Int64() => long.Parse(String());
        public ulong UInt64() => ulong.Parse(String());
        public double Double() => double.Parse(String());
        public string[] Split() => String().Split().ToArray();
        public int[] SplitInt32() => String().Split().Select(s => int.Parse(s)).ToArray();
        public long[] SplitInt64() => String().Split().Select(s => long.Parse(s)).ToArray();
        public ulong[] SplitUInt64() => String().Split().Select(s => ulong.Parse(s)).ToArray();
        public double[] SplitDouble() => String().Split().Select(s => double.Parse(s)).ToArray();

        public IEnumerable<string> Repeat(int count)
        {
            for (int i = 0; i < count; i++)
                yield return String();
        }
        public IEnumerable<int> RepeatInt32(int count)
        {
            for (int i = 0; i < count; i++)
                yield return Int32();
        }
        public IEnumerable<long> RepeatInt64(int count)
        {
            for (int i = 0; i < count; i++)
                yield return Int64();
        }
        public IEnumerable<string[]> RepeatSplit(int count)
        {
            for (int i = 0; i < count; i++)
                yield return Split();
        }
        public IEnumerable<int[]> RepeatSplitInt32(int count)
        {
            for (int i = 0; i < count; i++)
                yield return SplitInt32();
        }
    }
    static class DicExt
    {
        public static V GetOrDefault<K, V>(this Dictionary<K, V> dic, K key, V defaultValue = default(V))
        {
            V val;
            return dic.TryGetValue(key, out val) ? val : defaultValue;
        }
    }
}


Measured memory_bytes: 12512
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

bool arr[10000010];

void Eratosthenes() {
	rep(i, 10000010)arr[i] = true;
	arr[0] = arr[1] = false;

	arr[0] = arr[1] = false;
	for (int i = 2; i <= sqrt(10000008); i++) {
		if (arr[i]) {
			for (int j = 0; i*(j + 2) <= 10000008; j++)
				arr[i*(j + 2)] = false;
		}
	}

}

int main()
{
	int n;
	Eratosthenes();
	while (cin >> n, n) {
		int i = n;
		while (!(arr[i] && arr[i - 2] && arr[i - 6] && arr[i - 8]))i--;
		cout << i << endl;
	}
	return	0;
}

Measured memory_bytes: 12816
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define int long long
using P = pair<int,int>;

signed main(){
  string s;
  int k;
  cin >> s >> k;
  int len = s.size();
  vint A(len);
  rep(i,len){
    if(s[i] != 'a'){
      A[i] = 'z' - s[i] + 1;
    }
  }
  rep(i,len){
    if(k >= A[i]){
      k -= A[i];
      A[i] = 0;
    }
  }
  if(k > 0){
    if(A[len-1] > k) A[len-1] = (A[len-1] - k)%26;
    else A[len-1] = 26 - (k%26);
  }
  rep(i,len){
    if(A[i] == 0) cout << 'a';
    else cout << (char)('z'-A[i]+1);
  }
  cout << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i< (int)(n); i++)
#define rep2(i,x,n) for(int i = (int)x; i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define repitr(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	int n;
	string s;
	cin >> s;
	n = s.size();
	int spoint = -1;//lr_l
	vector<int> ans(n, 0);
	rep(i, n){
		if(i != n-1){
			if(s[i] == 'R' && s[i+1] == 'L'){
				ans.at(i) += (i-spoint+1)/2;
				ans.at(i+1) += (i-spoint)/2;
				spoint = i;
			}else if(s[i] == 'L' && s[i+1] == 'R'){
				ans.at(spoint+1) += (i-spoint+1)/2;
				ans.at(spoint) += (i-spoint)/2;
				spoint = i;
			}
		}else{
			ans.at(spoint+1) += (i-spoint+1)/2;
				ans.at(spoint) += (i-spoint)/2;
				spoint = i;
		}
	}
	rep(i, n){
		if(i != 0) cout << " ";
		cout << ans.at(i);
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
  
  int n,k;
  cin>>n>>k;
  int cnt = 0;
  for(int i=1;i<=n;i++){
    ll a,b;
    cin>>a>>b;
    if(sqrt(a*a+b*b)<=k) cnt++;
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 3684
n=int(input())
def dfs(k,n):
  if k>n:
    return 0
  c=0
  if '3' in str(k) and '5' in str(k) and '7' in str(k):
    c=1
  l=len(str(k))
  return c+dfs(k+3*10**l,n)+dfs(k+5*10**l,n)+dfs(k+7*10**l,n)
print(dfs(3,n)+dfs(5,n)+dfs(7,n))

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>

using namespace std;

int main(){
  int n, d;
  cin >> n >> d;
  long long a, b, f=0;
  for(int x=0;x<n;x++){
    cin >> a >> b;
    a*=a;
    b*=b;
    long double z = sqrt(a+b);
    if(z<=d){
      f++;
    }
  }
  cout << f;

}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
void YES(){cout<<"YES\n";} void NO(){cout<<"NO\n";}
void SD(int t=0){ cout<<"PASSED "<<t<<endl; }
const ll INF = ll(1e18);
const int MOD = 998244353;

bool DEBUG = 0;
const int MAXN = 100005;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	int n,m,K; cin>>n>>m>>K;
	string a[n];
	forn(i,0,n) cin>>a[i];
	
	ll ans=0;
	for(int m1=0;m1<(1<<n);m1++) for(int m2=0;m2<(1<<m);m2++){
		int cnt=0;
		for(int i=0;i<n;i++) for(int j=0;j<m;j++){
			if((1<<i)&m1) continue;
			if((1<<j)&m2) continue;
			if(a[i][j]=='#') cnt++;
		}
		if(cnt==K) ans++;
	}
	cout<<ans<<'\n';
	
	return 0;
}


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

using namespace std;

const int N = 1e5 + 5;

int ans[N];
char  s[N];

main(){
    scanf("%s" , s);

    for(int i = 1 ; s[i] ; i ++){

        if((s[i] == 'L') && (s[i-1] == 'R') ){

            for(int j = i ; s[j] ; j ++){
                if(s[j] == 'R')break;
                if((j-i)&1)ans[i-1] ++;
                else ans[i] ++;
            }

            for(int j = i-1 ; j >= 0 ; j --){
                if(s[j] == 'L')break;
                if((i-j-1)&1)ans[i] ++;
                else ans[i-1] ++;
            }
        }
    }

    printf("%d" , ans[0]);
    for(int i = 1 ; s[i] ; i ++){
        printf(" %d" , ans[i]);
    }

    return 0;
}


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

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

int main(){

    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    int ans = gcd(a[0], a[1]);
    for(int i = 2; i < n; i++){
        ans = gcd(ans, a[i]);
    }    

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

Measured memory_bytes: 640
import sys
from collections import Counter

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(N, M, inputs):
    answers = inputs
    n_solve = 0
    n_pena = 0
    solve_progress = set()
    num_answers = Counter({})

    for ans in answers:
        a = ans.split()
        number = int(a[0])
        result = a[1]

        if number in solve_progress:
            continue
        if result == "AC":
            solve_progress.add(number)
            n_solve += 1
        else:
            num_answers[number] += 1

    for s in solve_progress:
        n_pena += num_answers[s]
    return "{} {}".format(n_solve, n_pena)


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    [N, M] = string_to_int(input())
    ret = solve(N, M, inputs(M))
    print(ret)


Measured memory_bytes: 61784
r, c = gets.split.map(&:to_i)

sheet = Array.new(r + 1){Array.new(c + 1, 0)}

r.times do |i|
  sheet[i] = gets.split.map(&:to_i)
  sheet[i][c] = sheet[i].inject{|sum, a| sum + a}
  (c + 1).times do |j|
    sheet[r][j] += sheet[i][j]
  end
  puts sheet[i].join(" ")
end
puts sheet[r].join(" ")

Measured memory_bytes: 9040
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
// mt19937 gen_rand_int(chrono::steady_clock::now().time_since_epoch().count());
// mt19937_64 gen_rand_ll(chrono::steady_clock::now().time_since_epoch().count());
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
long long power(long long a, long long b,long long m) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a %m;
        a = a * a %m;
        b >>= 1;
    }
    return res;
}
 
 
signed main()
{
 
ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   
 
#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif      
    
    int n,m,k;
    cin>>n>>m>>k;
    for(int i=0;i<=n;i++)
    {   
        for(int j=0;j<=m;j++)
        {
            int x=i*m+j*n-(i*j)*2;
            if(x==k)
            {
                cout<<"Yes";
                return 0;
            }
        }
    }
    k=n*m-k;
    for(int i=0;i<=n;i++)
    {   
        for(int j=0;j<=m;j++)
        {
            int x=i*m+j*n-(i*j)*2;
            if(x==k)
            {
                cout<<"Yes";
                return 0;
            }
        }
    }
    cout<<"No";

} 

Measured memory_bytes: 3600
#include <math.h>
#include <stdio.h>

int rel_l_l( double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4 ) {
	int rel;

	rel = 0;
	if ( fabs( ( x1 - x2 ) * ( x3 - x4 ) + ( y1 - y2 ) * ( y3 - y4 ) ) < 1e-10 )
		rel = 1;
	else if ( fabs( ( x1 - x2 ) * ( y3 - y4 ) - ( y1 - y2 ) * ( x3 - x4 ) ) < 1e-10 ) {
		rel = 2;
		if ( fabs( ( x1 - x3 ) * ( y3 - y4 ) - ( y1 - y3 ) * ( x3 - x4 ) ) < 1e-10 )
			rel = 3;
	}

	return rel;
}

int main( void ) {
	int q;

	scanf( "%d", &q );
	while ( q-- ) {
		int rel;
		double x1, y1, x2, y2, x3, y3, x4, y4;

		scanf( "%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4 );

		rel = rel_l_l( x1, y1, x2, y2, x3, y3, x4, y4 );
		printf( "%d\n", rel >= 2 ? 2 : rel );
	}

	return 0;
}

Measured memory_bytes: 640
n=int(input())
a=[int(i) for i in input().split()]

check=False
minus=0
mini=float('inf')
total=0
for i in a:
    if i==0:
        check=True
    if i<0:
        minus+=1
    total+=abs(i)
    mini=min(mini,abs(i))


if minus%2==0:
    check=True

    
print(total if check else total-mini*2)

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

#define OUT(a) { cout << a << "\n"; exit(0); }

int main() {
  vector<int> a(3);
  rep(i, 3) cin >> a[i];
  int ma = max({a[0], a[1], a[2]});
  int sum = a[0] + a[1] + a[2];
  if (ma % 2 == sum % 2) {
    cout << (3 * ma - sum) / 2 << endl;
    exit(0);
  }
  cout << (3 * (ma + 1) - sum) / 2 << endl;
}


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

int main() {
  int N;
  cin >> N;
  string ans = "";
  int n = N % 10;
  if (n == 3) {
    ans = "bon";
  }
  else if (n == 0 || n == 1 || n == 6 || n == 8) {
    ans = "pon";
  }
  else {
    ans = "hon";
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3576
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		int Y = sc.nextInt();
		int[] x = new int[N];
		int[] y = new int[M];
		
		for (int i = 0; i < N; i++) {
			x[i] = sc.nextInt();;
		}
		for (int i = 0; i < M; i++) {
			y[i] = sc.nextInt();;
		}
		boolean flag1 = false;
		boolean flag2 = false;
		for (int i = X+1; i <= Y; i++) {
			for (int j = 0; j < N; j++) {
				if (x[j]<i) {
					flag1 = true;
				} else {
					flag1 = false;
					break;
				}
			}
			if (!flag1){
				continue;
			}
			for (int j = 0; j < M; j++) {
				if (y[j]>=i) {
					flag2 = true;
				} else {
					flag2 = false;
					break;
				}
			}
			if (flag1&&flag2) {
				break;
			}
		}
		if(flag1&&flag2){
			System.out.println("No War");						
		} else {
			System.out.println("War");						
		}
		
		
		// 入力
		/*
		String S = sc.next();                
		String T = sc.next();                
		
		for (int i = 0; i < S.length(); i++) {
			if (!S.substring(i,i+1).equals(T.substring(i,i+1))) {
				if (S.indexOf(T.substring(i,i+1)) == -1) {
					S = S.replace(S.substring(i,i+1), T.substring(i,i+1));
				} else {
					String s = S.substring(0, S.length());
					StringBuilder sb = new StringBuilder("");
					for (int j = 0; j < s.length(); j++) {
						if (s.substring(j, j+1).equals(S.substring(i, i+1))) {
							sb.append(T.substring(i, i+1));
						} else if (s.substring(j, j+1).equals(T.substring(i, i+1))) {
							sb.append(S.substring(i, i+1));							
						} else {
							sb.append(s.substring(j, j+1)); 
						}
					}
					S = sb.toString();
				}
			}
		}
		if(S.equals(T)){
			System.out.println("Yes");			
		} else {
			System.out.println("No");			
		}
	*/
	}	
}


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

int main()
{
	int a,summ=0;
	cin>>a;
	int b=a;
	while(a)
	{
		summ+=a%10;
		a/=10;
	}
	if(b%summ==0)	cout<<"Yes";
	else			cout<<"No";
}

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

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

	ll x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;
	vector<ll> aVec(a);
	vector<ll> bVec(b);
	vector<ll> cVec(c);
	rep(i, a) cin >> aVec[i];
	rep(i, b) cin >> bVec[i];
	rep(i, c) cin >> cVec[i];

	sort(aVec.rbegin(), aVec.rend());
	sort(bVec.rbegin(), bVec.rend());
	sort(cVec.rbegin(), cVec.rend());

	vector<ll> resultVec(x+y+c);

	rep(i, x) resultVec.push_back(aVec[i]);
	rep(i, y) resultVec.push_back(bVec[i]);
	rep(i, c) resultVec.push_back(cVec[i]);

	sort(resultVec.rbegin(), resultVec.rend());
	ll result = 0;
	rep(i, x + y) result += resultVec[i];
	
	cout << result << '\n';

	return 0;
}

Measured memory_bytes: 8832
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String t = sc.next();
    if(t.equals("xxx")){
      System.out.print(700);
    }else if(t.equals("oxx")||t.equals("xox")||t.equals("xxo")){
      System.out.print(800);
    }else if(t.equals("oox")||t.equals("oxo")||t.equals("xoo")){
      System.out.print(900);
    }else{
      System.out.print(1000);
    }
  }
  

  
}


Measured memory_bytes: 21972
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
#define rep(i,a,n)	for(int i=a;i<n;i++)
int main(){
	string s,t,u;
	cin>>s>>t>>u;
	cout<<s[0]<<t[1]<<u[2]<<endl;
}

Measured memory_bytes: 760
#include<math.h>
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ll long long int
#define ull unsigned long long
#define py printf("Yes\n")
#define pn printf("No\n")
#define in cin>>
using namespace std;
int INF = 1001001001;
const int MOD=1e9+7;

int main()
{
    int n;
    in n;
    if(n%10==2||n%10==4||n%10==5||n%10==7||n%10==9)cout<<"hon"<<endl;
    else if(n%10==0||n%10==1||n%10==6||n%10==8)cout<<"pon"<<endl;
    else cout<<"bon"<<endl;

}


Measured memory_bytes: 3624
#include <stdio.h>
#include <vector>
#include <iostream>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;


int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n, k, i;
    string s;
    cin >> n >> k;
    cin >> s;

    int score = 0;
    for (i=0;i<n;i++){
        if (s[i] == 'L'){
            if (i>0 && s[i-1] == s[i])
                score += 1;
        }
        else{
            if (i<n-1 && s[i] == s[i+1])
                score += 1;
        }
    }
    score = min(n-1, score + 2*k);
    cout << score << endl;
}

Measured memory_bytes: 512
l=sorted(map(int,input().split()))
cnt=0
while l[2]-l[1]>1 or l[2]-l[0]>1:
    if l[2]-1>l[0]: l[0]+=2
    else: l[1]+=2
    cnt+=1
if l[0]==l[1]==l[2]: print(cnt)
elif l[1]==l[0]:print(cnt+1)
else:print(cnt+2)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ED(x) ((int)x.size()-1)
#define _for(i,a,b) for(int i=(a);i<=(b);++i)
#define _rep(i,a,b) for(int i=(a);i>=(b);--i)
#define changxv ios::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

template<typename T>
void dbg(const char*s,T h){cerr<<s<<'='<<h<<'\n';}
template<typename T,typename...A>
void dbg(const char*s,T h,A...t){
	while(*s!=',')cerr<<*s++;
	cerr<<'='<<h<<", ";
	dbg(s+1,t...);
}
#define put(...) dbg(#__VA_ARGS__,__VA_ARGS__);

const int maxn=1e6+3;
const int INF=0x3f3f3f3f;
const int mod=1e9+7;

int x[7],y[7];
struct node{
	int x,y,flag;
}a[5],b[5];
int ans;
int fac[maxn<<1],invfac[maxn<<1];

int Qpow(int x,int k){
	int tmp=1;
	for(;k;k>>=1,x=(ll)x*x%mod)if(k&1)tmp=(ll)tmp*x%mod;
	return tmp;
}

void Pre(){
	const int lim=2e6;
	fac[0]=invfac[0]=1;
	_for(i,1,lim)fac[i]=(ll)fac[i-1]*i%mod;
	invfac[lim]=Qpow(fac[lim],mod-2);
	_rep(i,lim-1,1)invfac[i]=(ll)invfac[i+1]*(i+1)%mod;
}

int C(int a,int b,int c,int d){
	return (ll)fac[c+d-a-b]*invfac[c-a]%mod*invfac[d-b]%mod;
}

int Cal(const node&a,const node&b){
	int tmp=0;
	_for(i,x[3],x[4])(tmp+=(ll)C(a.x,a.y,i,y[3]-1)*C(i,y[3],b.x,b.y)%mod*(-i-y[3])%mod)%=mod;
	_for(i,y[3],y[4])(tmp+=(ll)C(a.x,a.y,x[3]-1,i)*C(x[3],i,b.x,b.y)%mod*(-i-x[3])%mod)%=mod;
	_for(i,x[3],x[4])(tmp+=(ll)C(a.x,a.y,i,y[4])*C(i,y[4]+1,b.x,b.y)%mod*(i+y[4]+1)%mod)%=mod;
	_for(i,y[3],y[4])(tmp+=(ll)C(a.x,a.y,x[4],i)*C(x[4]+1,i,b.x,b.y)%mod*(i+x[4]+1)%mod)%=mod;
	return tmp;
}

int main(){changxv
	Pre();
	_for(i,1,6)cin>>x[i];
	_for(i,1,6)cin>>y[i];
	int cnt=1;
	a[1]=(node){x[2],y[2],1};
	a[2]=(node){x[1]-1,y[1]-1,1};
	a[3]=(node){x[1]-1,y[2],-1};
	a[4]=(node){x[2],y[1]-1,-1};
	b[1]=(node){x[6]+1,y[6]+1,1};
	b[2]=(node){x[5],y[5],1};
	b[3]=(node){x[5],y[6]+1,-1};
	b[4]=(node){x[6]+1,y[5],-1};
	_for(i,1,4){
		_for(j,1,4){
			(ans+=a[i].flag*b[j].flag*Cal(a[i],b[j]))%=mod;
			if(ans<0)(ans+=mod)%=mod;
		}
	}
	cout<<ans<<'\n';
return 0; }

Measured memory_bytes: 15872
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <bitset>
#include <queue>
#include <set>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;

#define LL long long
#define ULL unsigned long long
#define eps 1e-9
#define N 201000
#define M 600050
#define pii pair<int,int>
#define MP make_pair
#define inf 0x3f3f3f3f
#define md ((ll+rr)>>1)
#define lson ll, md, ls
#define rson md + 1, rr, rs
#define ls rt<<1
#define rs rt<<1|1
#define Pi acos(-1.0)
#define mod 1000000007
#define ui unsigned int
// curiosity , go.
LL powmod(LL a,LL b,LL p){
    if(b < 0) return 0;
    LL res = 1; a %= p;
    for(;b;b>>=1){
        if(b & 1) res = res * a % p;
        a = a * a % p;
    }
    return res;
}

int dp[4010][4010],vis[4010][4010];
int fac[8010],invf[8010];

void add(int &a,int b){
    a += b;
    if(a >= mod) a -= mod;
}

int main(){
    int n;
    fac[1] = invf[1] = 1;
    for(int i = 2; i <= 8000; i++){
        fac[i] = 1LL * fac[i - 1] * i % mod;
        invf[i] = (int)powmod(fac[i], mod-2, mod);
    }
    scanf("%d",&n);
    int ans = 0;
    for(int i = 1,x,y; i <= n; i++){
        scanf("%d%d",&x,&y);
        dp[2000-x][2000-y]++;
        vis[2000+x][2000+y]++;
        ans -= 1LL * fac[2*x+2*y] * invf[2*x] % mod * invf[2*y] % mod;
        if(ans < 0) ans += mod;
    }
    //cout<<mod - ans<<endl;
    for(int i = 0; i <= 4000; i++)
        for(int j = 0; j <= 4000; j++){
            if(i >= 1) add(dp[i][j],dp[i-1][j]);
            if(j >= 1) add(dp[i][j],dp[i][j-1]);
            if(vis[i][j]) add(ans, 1LL * dp[i][j] * vis[i][j] % mod);
        }
    printf("%d\n",1LL * ans * powmod(2, mod - 2, mod) % mod);
}

Measured memory_bytes: 86272
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>

typedef long long ll;

using namespace std;
int main() {
    string s;
    ll n,i;
    cin >> n >> i;
    
    
    cout << n-i+1 << endl;
    return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include <iomanip>
#include <math.h>
using namespace std;
struct Point  {
	double x;
	double y;
	Point(double _x,double _y):x(_x),y(_y){}
	Point operator+(const Point & a) const {
		return	Point(x + a.x,y + a.y);
	}
	Point operator-(const Point & a) const {
		return	Point(x - a.x,y - a.y);
	}
	Point operator*(const int r) const {
		return	Point(x * r,y * r);
	}
	Point operator/(const int r) const {
		return	Point(x / r,y / r);
	}
	void print()const{
		cout << fixed << std::setprecision( 6 )  << x << " " << y << std::endl;
	}
};
Point computeTriangleTop(const Point s,const Point t){
	Point a = t - s;
	const double pi = 3.14159265359879;
	const double cos60 = cos(pi / 3);
	const double sin60 = sin(pi / 3);
	return	s + 
		Point(cos60*a.x - sin60*a.y,
				sin60*a.x + cos60*a.y);
}
void KochCurve(int level, int n, Point p1,Point  p2) {
	if (level == n){
		p2.print();
		return;
	}
	Point s = (p1*2 + p2) / 3;
	Point t = (p1 + p2*2) / 3;
	Point u = computeTriangleTop(s,t);
	KochCurve(level+1,n,p1,s);
	KochCurve(level+1,n,s,u);
	KochCurve(level+1,n,u,t);
	KochCurve(level+1,n,t,p2);
}

int main(){
	int n;
	cin >> n;
	Point P1(0,0),P2(100,0);
	P1.print();
	::KochCurve(0,n,P1,P2);
}

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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll d, m;
    cin >> m >> d;

    ll ret = 0;
    FOR(i, 1, m+1) FOR(j, 1, d+1) {
        ll d1 = j%10, d2 = j/10;
        if(d1 >= 2 && d2 >= 2 && i == d1*d2) {
            ret++; 
        }
    }
    cout << ret << endl;

    return 0;
}


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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (abs(c-a)<=d || abs(b-a)<=d&&abs(c-b)<=d) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

	int r, c, i, j, su;

	scanf(" %d  %d", &r, &c);
	int rc[101][101] = {0};

	
	for(i = 0; r > i; i++){
		for(j = 0; c > j; j++){
			scanf(" %d", &su);
			
			rc[i][j] = su;	
			rc[i][100] = rc[i][100] + su;
			rc[100][j] = rc[100][j] + su;
			rc[100][100] = rc[100][100] + su;
			
		}
		

		}
	
	for(i = 0; r+1 > i; i++){
		for(j = 0; c+1 > j; j++){
			if(i == r && j == c){
				printf("%d", rc[100][100]);
			}
			else if(i == r){
				printf("%d", rc[100][j]);
			}
			else if(j == c){
				printf("%d", rc[i][100]);
			}
			else{
				printf("%d", rc[i][j]);
			}
			if(j != c ){
				printf(" ");
			}
		}printf("\n");
	}
	
	
	
	

	return 0;
}

Measured memory_bytes: 652
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

int N;
int cnt[101];

int main(){
    cin>>N;

    for(int i=2;i<=N;i++){
        int x=i;
        for(int j=2;j<=i;j++){
            if(x%j==0){
                x/=j;
                cnt[j]++;
                j--;
            }
        }
    }

    int c3=0,c5=0,c15=0,c25=0,c75=0;
    repn(i,N){
        if(cnt[i]>=74) c75++;
        else if(cnt[i]>=24) c25++;
        else if(cnt[i]>=14) c15++;
        else if(cnt[i]>=4) c5++;
        else if(cnt[i]>=2) c3++;
    }

    int ans=0;
    ans+=(c5+c15+c25+c75)*(c5+c15+c25+c75-1)/2*(c3+c5+c15+c25+c75-2);
    ans+=(c25+c75)*(c3+c5+c15+c25+c75-1);
    ans+=(c15+c25+c75)*(c5+c15+c25+c75-1);
    ans+=c75;

    cout<<ans<<endl;
}

Measured memory_bytes: 256
N = gets.to_i
s = []
for i in 0..N-1
    s[i] = gets.to_i 
end

if s.all?{|x| x % 10 == 0}

    puts 0

else 

    if s.inject(:+) % 10 == 0
        
        puts s.inject(:+) - s.select{|x| x % 10 != 0}.min 

    else

        puts s.inject(:+)

    end

end


Measured memory_bytes: 1788
n, k = map(int, input().split())

MOD=10**9+7

def sum_l(a,b):
    return (b-a+1)*(a+b)//2 %MOD

count=0
for i in range(k,n+1):
    min_i=sum_l(0,i-1)
    max_i=sum_l(n-i+1,n)
    count+=(max_i-min_i+1)%MOD

print((count+1)%MOD)

Measured memory_bytes: 9196
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1ll << 60;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, W, v[105], w[105], DP[105][int(1e4 + 5)];

int main(){
  scanf("%d%d", &N, &W);
  for (int i = 1; i <= N; i++) scanf("%d%d", v + i, w + i);

  for (int i = 1; i <= N; i++){
    for (int j = 0; j <= W; j++) DP[i][j] = DP[i - 1][j];

    for (int j = w[i]; j <= W; j++){
      DP[i][j] = max(DP[i][j], DP[i][j - 1]);
      DP[i][j] = max(DP[i][j], DP[i - 1][j - w[i]] + v[i]);
      DP[i][j] = max(DP[i][j], DP[i][j - w[i]] + v[i]);
    }
  }
  cout << DP[N][W] << endl;

  return 0;
}



Measured memory_bytes: 7148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi; 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
const int mod = 1e9+7;
const int maxn = 5e5+10;
const int inf = 0x3f3f3f3f;
char str[maxn];
bool check(int l,int r) {
	while(l<r) {
		if(str[l]!=str[r]) return false;
		l++;
		r--;
	}
	return true;
}
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	cin>>str;
	int len=strlen(str);
	if(check(0,len-1)&&check(0,(len-1)/2-1)&&check((len+3)/2-1,len-1)) 
		cout<<"Yes"<<'\n';
	else cout<<"No"<<'\n';
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long n = Long.parseLong(sc.next());
    long res ;
    if(n%2==1){
      res = 0;
    }else{
      long base = 5;
      res = 0;
      while(n >= base){
        res+=n/base/2;
        base*=5;
      }
    }
    System.out.println(res);
    
  }
}

Measured memory_bytes: 23764
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cmath>
using namespace std;

#define int long long
#define endl "\n"
#define all(v)  v.begin(),v.end()
#define fir first
#define sec second
#define m_p make_pair
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
#define vecout(v,n) for(int i=0; i<n; i++)cout<<v[i]<<" "; cout<<endl;

const int mod = 1000000007;
const int INF = 2000000015;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int krag(double xx) {
	return INF - (int)(INF - xx);
}


int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}




signed main() {
	int n, m,a,b,t=0;
	cin >> n >> m;
	vector<int>vec(n);
	vecin(vec);
	sort(all(vec));
	map<int, int>ma;
	rep(i, m) {
		cin >> a >> b;
		if (!ma.count(b)) {
			ma[b] = a;
		}
		else {
			ma[b] += a;
		}
	}
	rep(i, n) {
		if (!ma.empty() && ma.rbegin()->first > vec[i]) {
			t += ma.rbegin()->first;
			ma.rbegin()->second--;
			if (ma.rbegin()->second == 0) {
				ma.erase(ma.rbegin()->first);
			}
		}
		else {
			t += vec[i];
		}
	}
	cout << t << endl;
}




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

int main()
{
	int x;
	cin >> x;
	int g = (double)x/1.08;
	if(g == x/1.08) printf("%d\n",g);
	else{
		g++;
		if((int)(g*1.08) == x) printf("%d\n",g);
		else printf(":(\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>     // std::cout
#include <algorithm>    // std::next_permutation, std::sort
using namespace std;

int permu(int a[],int b[],int n)
{

	int ans=0;
	 
	  do {
	  	   bool chk=false;
		   for(int i=0;i<n;i++)
		   	{
		  	 	if(a[i]!=b[i]){chk=true; break;}
		    }
		   if(chk==false)
		   	break;
		   ans++;

		 

	  } while ( next_permutation(a,a+n) );
	  return ans;
}

int main() {
	//freopen("in.txt","r",stdin);
  
  int n;
  cin>>n;
  int arr[20];
  int arr1[20];
  for(int i=0;i<n;i++)
  	cin>>arr[i];

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

  int chk=0;
     for(int i=0;i<n;i++)
     	{
     	  if(arr[i]!=arr1[i])
     	  	{ 
     	  		if(arr[i] >arr1[i])chk=1;
     	  		else chk=2;
     	  		break;
     	  	}
     	}
     	if(chk!=2)
     	cout<<permu(arr1,arr,n);
     else
     	cout<<permu(arr,arr1,n);


  return 0;
}

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

int main()
{
    map<int,bool> memo;
    int N;
    cin>>N;
    int cnt = 0;
    for(int i=0; i<N; i++)
    {
        int p[3];
        cin>>p[0]>>p[1]>>p[2];
        sort(p,p+3);
        int k = ((p[0]-1)*1000+(p[1]-1))*1000+(p[2]-1);
        if(memo.find(k)!=memo.end())
        {
            cnt++;
        }
        else
        {
            memo[k]=true;
        }
    }
    cout<<cnt<<endl;
    return 0;
}


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

int main() 
{
		int n;
		cin>>n;
		vector<pair<int,int>>st;
		int x;
		for(int i=1;i<=n;i++)
		{
			cin>>x;
			st.push_back({x,i});
			
		}
		sort(st.begin(),st.end());
		for(auto x: st)
		{
			cout<<x.second<<" ";
		}
		
		
		
}

Measured memory_bytes: 1780