akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A
{
    class Program
    {
        public static void Main(string[] args)
        {
            var s = ReadLine();
            Console.WriteLine((s[2] == s[3] && s[4] == s[5]) ? "Yes" : "No");
            ReadLine();
        }

        //最大公約数
        static int gcd(int a, int b)
        {
            if(a > b) {
                return gcd(b, a);
            }

            while(b != 0) {
                var remainder = a % b;
                a = b;
                b = remainder;
            }

            return a;
        }

        //最小公倍数
        static int lcm(int a, int b) => a * b / gcd(a, b);

        /// <summary>
        /// コンビネーション
        /// </summary>
        static int nCm(int n, int m)
        {
            if (m == 0) return 1;
            if (n == 0) return 0;
            return n * nCm(n - 1, m - 1) / m;
        }

        public static string ReadLine() => Console.ReadLine();
        public static int ReadLineInt() => int.Parse(Console.ReadLine());
        public static string[] ReadLineStringSplit(char a = ' ') => ReadLine().Split(a).ToArray();
        public static int[] ReadLineIntSpilit(char a = ' ') => ReadLine().Split(a).Select(x => int.Parse(x)).ToArray();
        static string[] GetAplhaLowerArray() => new string[]{ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
        static string[] GetAplhaUpperArray() => new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
    }
}

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

int main(void) {
  int A,B;
  int x=1;
  cin >> A >> B;
  if(B==100)B=101;
  for(int i=0;i<A;i++){
  	x*=100;
  }
  x*=B;
  cout << x << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	void doIt() {
		int a = sc.nextInt();
		int b = sc.nextInt();
		int t = sc.nextInt();
		int next = 0, cnt = -b, i = 1;
		while(next <= t) {
			next += a * i;
			cnt+= b;
		}
		System.out.println(cnt);
		
	}
	
	public static void main(String[] args) {
		new Main().doIt();
	}
}


Measured memory_bytes: 22740
import itertools
N = int(input())

test = {}

V = list(map(int,input().split()))
C = list(map(int,input().split()))
new_n = 0
for i in range(N):
    if V[i] <=  C[i]:
        continue
    else:
        test[i] = [V[i],C[i]]
        new_n += 1

N = new_n

def calc_cost(com,test,i):
    x = 0
    y = 0
    for j in com:
        x += test[j][0]
        y += test[j][1]
    return x - y

ans = 0

for i in range(N):
    c = itertools.combinations(test.keys(), i+1)
    for j in c:
        ans = max(ans,calc_cost(j,test,i))


print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define F first
#define S second
#define int long long
#define double long double
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,int> Pi;
typedef pair<P,P> PP;
double eps=1e-8;
int mod=1e9+7;
int inf=1LL<<55;

priority_queue<P,vector<P>,greater<P> > pq;

template <typename T>
int Count(const vector<T> &v, T l,T r){
  //counting [l,r]
  auto L = lower_bound(v.begin(), v.end(), l );
  auto R = upper_bound(v.begin(), v.end(), r );
  // [l,r) change upper -> lower
  return R-L;
}

signed main(){
  int n,mn=1e18,s=0;
  cin>>n;
  vector<int> a(n),b(n);
  for(int i=0;i<n;i++){
    cin>>a[i]>>b[i];
    if(a[i]>b[i])mn=min(mn,b[i]);
    s+=a[i];
  }
  if(mn==1e18)mn=s;
  cout<<s-mn<<endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <math.h>
using namespace std;
int main(){
   string s;
   cin >> s;
   string arp = "abcdefghijklmnopqrstuvwxyz";
	for (int i=0; i<26; i++) {
		int chk;
		chk = s.find(arp[i]);
		if (chk==-1) {
		  cout << arp[i];
		  break;
		}
		if (i==25) {
		  cout << "None";
		}
	}
	cout << endl;
}

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

int main(){
  int N;
  string result = "No";
  
  cin >> N;
  if(N > 81){
     result = "No";
  }else{
    for(int i = 1; i < 10; i++){
      int tmp = N % i;
      if(tmp == 0){
        int square = N/i;
        if(square < 10){
          result = "Yes"; 
        }
      }
    }
  }
  
  cout << result << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N; cin >> N;
  vector<int> L(N);
  for(int i = 0; i < N; i++) cin >> L.at(i);
  sort(L.begin(), L.end());
  ll cnt = 0;
  for(int i = 0; i < N; i++) {
    for(int j = i + 1; j < N; j++) {
      int a = L.at(i), b = L.at(j);
      int l = j, r = N;
      while(r -l > 1) {
        int mid = (l + r) / 2;
        if(L.at(mid) < a + b) l = mid;
        else r = mid;
      }
      int x = j, y = N;
      while(y - x > 1) {
        int MID = (x + y) / 2;
        if(L.at(MID) > max(a - b, b - a)) y = MID;
        else x = MID;
      }
      if(l == j || y == N) continue;
      if(l == j) l++;
      if(y == N) y--;
      cnt += max(l - y + 1, 0);
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#define MAX 100000

using namespace std;

int n;
long k;
long a[MAX + 1];
int main() {
	cin >> n >> k;
	int a1;
	long b1;
	for (int i = 0; i < n; ++i) {
		cin >> a1 >> b1;
		a[a1] += b1;
	}
	int num = 1;
	long sumN;
	sumN = a[num];
	for (; sumN < k; sumN += a[num]) {
		++num;
	}

	cout << num << endl;
}

Measured memory_bytes: 1024
#import 
#=input()
#=int(input())
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
#=[list(map(int,input().split())) for _ in range()]

la = [0]
lb = [0]
for i in range(n):
    la += [a[i]+la[i]]
for i in range(m):
    lb += [b[i]+lb[i]]
j = m
ans = 0
for i in range(n+1):
    if la[i] > k:
        break
    while lb[j] > k - la[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)

Measured memory_bytes: 47364
D,G=map(int,input().split())
PC=[list(map(int,input().split())) for i in range(D)]


def solve(G, i):
    if i <= 0:
        return float('inf')
    n = min(G//(100*i), PC[i-1][0])
    score = 100 * i * n
    if n == PC[i-1][0]:
        score += PC[i-1][1]
    if G > score:
        n += solve(G-score, i-1)
    return min(n, solve(G, i-1))
 
 
print(solve(G, D))

Measured memory_bytes: 39920
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int ans=0,s0=0,s1=0;
	if(s.length()==1)
	{
	cout<<0;
	return 0;
    }
    for (int i=0;i<s.length();i++)
    if(s[i]=='0')
    s0++;
    else
    s1++;
    ans=min(s0,s1)*2;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 512
//#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

 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
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, M, A;
map <int, ll> mp;

int main(){
  scanf("%d%d", &N, &M);
  ll ans = 0, sum = 0;
  mp[0]++;
  for (int i = 0; i < N; i++){
    scanf("%d", &A);
    sum += A; sum %= M;
    ans += mp[sum]; mp[sum]++;
  }
  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long ulli;
typedef long double ldb;
 
#define endl '\n'
#define loop(i, m, n) for (lli i = m; i < n; i++)
#define loope(i, m, n) for (lli i = m; i <= n; i++)
#define epool(i, m, n) for (lli i = m; i >= n; i--)
#define maxe *max_element
#define mine *min_element
#define plli pair<lli, lli>
#define mod 1000000007
#define mod2 998244353
#define vt vector<lli>
#define fi first
#define se second
#define pb push_back
#define umap unordered_map
#define mmap multimap
#define MP make_pair
#define empf emplace_front
#define empb emplace_back
#define ret(x) return cout << x, 0;
#define all(v) v.begin(),v.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define pf push_front

#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
using namespace std;
 
lli gcd(lli a, lli b){
    if(a==0) return b;
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
 
lli lcm(lli a, lli b){
    return (a * b) / gcd(a, b);
}
 
lli modi(lli n,lli m=mod){ 
    if(n==0) return 0;
    n%=m;
    n+=m;
    n%=m;
    return n;
}
 
lli mpow(lli base, lli exp){
    base %= mod;
    lli result = 1;
    while (exp > 0){
        if (exp & 1)
            result = ((lli)result * base) % mod;
        base = ((lli)base * base) % mod;
        exp >>= 1;
    }
    return result;
}
const lli MIN=-1*1e18;
const lli INF=1e18+999999999999999999;
const lli N=2e5+5;
const ldb pi=4*atan(1);

lli n,m,k,t;
//lli a,b,c,d;
lli p,q,l,r;
lli arr[N];
//lli a[N],b[N],c[N],d[N];
lli a,b,c,d;
lli x[1000005],y[1000005];
//map<lli,lli> m1,m2;
vector<lli> v,v1,v2;
lli pre[N],suff[N];
//lli vis[N]={0};
char grid[100][100];
vector<pair<lli,lli>> pl;

int32_t main(){
    fast_io
    lli i = 0,j=0;
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
   // cout << fixed << setprecision(14);
   
    map<lli,lli> mp;
   
    v.clear();
    v1.clear();
    v2.clear();
    pl.clear();
    
    cin >> a >> b;
    if(a<=b) cout << "unsafe";
    else cout << "safe";


}

Measured memory_bytes: 3664
import sys
from collections import Counter

input = sys.stdin.readline

N = int(input())
l = []
for _ in range(N):
    l.append(input().strip())

c = Counter(l)
m = max(c.values())
c2 = [k for k, v in c.items() if v == m]

for x in sorted(c2):
    print(x)


Measured memory_bytes: 35572
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;

int N;
int dp[40][4];
int NG_index;
int P[40];
int T[40];

const int INF = (int)1e9;

int solve(int index, int num) {
  if(index == N) return P[index - 1];
  int &res = dp[index][num];
  if(res != -1) return res;
  res = INF;
  int curtime;
  int curpos;
  if(index == 0) {
    curtime = 0;
    curpos = 0;
  }
  else {
    curtime = T[index - 1];
    curpos = P[index - 1];
  }
  if(num <= 2 && curtime + (num + 1)*abs(P[index] - curpos) <= T[index]) {
    res = min(res, abs(P[index] - curpos) + solve(index + 1, num + 1));
  }
  if(curtime + (num + 1)*curpos + P[index] <= T[index]) {
    res = min(res, curpos + P[index] + solve(index + 1, 1));
  }
  if(res == INF) {
    NG_index = max(NG_index, 1 + index);
  }
  // cerr << "solve(" << index << "," << num << ") = " << res << endl;
  return res;
}

int main() {
  while(true) {
    cin >> N;
    if(N == 0) break;
    for(int i = 0; i < N; ++i) {
      cin >> P[i] >> T[i];
    }
    memset(dp, -1, sizeof(dp));
    NG_index = -1;
    int res = solve(0, 0);
    if(res == INF) {
      cout << "NG " << NG_index << endl;
    }
    else {
      cout << "OK " << res << endl;
    }
  }
}

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

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define sint int32_t
#define int long long int
#define all(v) v.begin() , v.end()
#define vii vector<int>
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int32_t main()
{   fastio;

    int x , k , d;
    cin>>x>>k>>d;

    int y = abs(x);
    int z = y/d;
    if(z>k)
    {
        cout<<(y-k*d)<<"\n";
    }
    else {
        int p = y-z*d;
        k -= z;
        if(k%2) cout<<min(abs(p-d) , abs(p+d))<<"\n";
        else cout<<p<<"\n";
    }

}

Measured memory_bytes: 3648
#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<ll, ll>;

int main( void )
{
	ll n, m;

	cin >> n >> m;

	ll sum = 0;
	while ( m-- ) {
		ll a;
		cin >> a;
		sum += a;
	}

	if ( sum > n ) {
		cout << -1 << endl;
	}
	else {
		cout << (n - sum) << endl;
	}

	return 0;
}


Measured memory_bytes: 3624
// サイクル検出 (DFSより楽)
// AOJ 2891
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

#define REP(i,m,n) for(int i=(int)m; i < (int) n; ++i)
#define rep(i,n) REP(i,0,n)
#define all(a) (a).begin(), (a).end()


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

    // 今回はサイクルが 1 つと決まっている木なので辺は n 本
    int n; cin >> n;
    vector<int> to[n];
    vector<int> deq(n);
    rep(i, n) {
        int a, b; cin >> a >> b;
        a--, b--;
        to[a].push_back(b);
        to[b].push_back(a);
        deq[a]++, deq[b]++;
    }

    queue<int> que;
    // 葉を que に加える(無向グラフなので出次数は 1 )
    rep(i, n) if(deq[i] == 1) que.push(i);

    vector<bool> isPushed(n, false);
    while(!que.empty()) {
        int v = que.front();
        que.pop();
        isPushed[v] = true;
        for(auto nv : to[v]) {
            deq[nv]--;
            if(deq[nv] == 1) que.push(nv);
        }
    }

    // クエリに答える
    int q; cin >> q;
    rep(i, q) {
        int a, b; cin >> a >> b;
        a--, b--;
        int ans = 0;
        if(!isPushed[a] && !isPushed[b]) ans = 2;
        else ans = 1;
        cout << ans << '\n';
    }

    return 0;
}


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

using namespace std;

#define boost ios::sync_with_stdio(0);cin.tie(0);
#define debug(s) cout << #s << " = " << s << endl
#define forn(i,n) for ( int i=0 ; i < n ; i++ )
#define all(a) (a).begin(), (a).end()
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define ll long long
#define endl '\n'
#define mod 1000000007

int main()
{
    //freopen ("f.in","r",stdin);
    //freopen ("f.out","w",stdout);
    boost
    //code
    int n;
    cin >> n;
    string s;
    cin >> s;
    int q;
    cin >> q;
    while(q--){
        int k;
        cin >> k;
        ll ans = 0;
        ll m = 0;
        ll c = 0;
        int i,j;
        i = 0;
        j = -1;
        ll add = 0;
        while(1){
                while(i<n&&s[i]!='D'){
                if(i<=j){
                    if(s[i]=='M'){
                        m--;
                        add -= c;
                    }
                    else if(s[i]=='C') c--;
                }
                i++;
            }
            if(i>=j) j = i+1;
            else{
                ans += add;
            }
            for(;j<min(i+k,n);j++){
                if(s[j]=='C'){
                    ans += m;
                    add += m;
                    c++;
                }
                else if(s[j]=='M') m++;
            }
            if(i>=n) break;
            i++;
        }
        cout << ans << endl;
    }
    return 0;
}

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

using namespace std;

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




Measured memory_bytes: 512
#include <bits/stdc++.h>
#define N 100010
#define pb push_back
#define fi first
#define se second
#define si size()
#define ll long long
#define mp make_pair
#define iter ::iterator
#define all(v) v.begin(), v.end()
#define pp pop_back
#define mapiter map<int, int>::iterator
#define forn(i, n) for(int i = 0; i < n; ++i)
#define forn1(i, n) for(int i = 1; i <= n; ++i)
#define forr(i, n)	for(int i = n - 1; i >= 0; --i)
#define forr1(i, n)	for(int i = n; i >= 1; --i)
#define form(l, r, i)	for(int i = l; i <= r; ++i)
#define forv(r, l, i)	for(int i = r; i >= l; --i)
#define r0 return 0
#define barnarnar ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define lld long double
#define elif else if
#define getb __builtin_popcount

const int inf = 1e9 + 7;
const lld EPS = 0.00000001;
const ll modw = 1e9 + 7;
 
using namespace std;

ll dp[N][2]; // number of ways to paint subtree with white or black root
// 0 - white
// 1 - black
vector<int> v[N];
int root = 0;

void dfs(int p, int x)
{
	if(v[x].si == 1 && x != root)	dp[x][0] = dp[x][1] = 1;
	ll cur1 = 1, cur2 = 1;
	for(auto i:v[x])
	{
		if(i != p)
		{
			dfs(x, i);
			cur1 *= (dp[i][0] + dp[i][1]);
			cur2 *= dp[i][0];
			cur2 %= modw;
			cur1 %= modw;
		}
	}
	dp[x][0] = cur1;
	dp[x][1] = cur2;
}

int main()
{
	barnarnar
	int n;
	cin >> n;
	if(n == 1)
	{
		cout << 2;
		r0;
	}
	forn(i, n - 1)
	{
		int t1, t2;
		cin >> t1 >> t2;
		v[t1].pb(t2);
		v[t2].pb(t1);
	}
	forn1(i, n)
	{
		if(v[i].si == 1)
		{
			root = i;
			break;
		}
	}
	dfs(0, root);
	/*
	cout << root << endl;
	for(int i = 1; i <= n; i++)
	{
		cout << "i: " << i << ' ' << dp[i][0] << ' ' << dp[i][1] << endl;
	}
	*/
	cout << (dp[root][0] + dp[root][1]) % modw;
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main() {
  int n, C;
  int d[30][30], pre[3][30], c[505][505];
  cin >> n >> C;
  rep(i, C) rep(j, C) cin >> d[i][j];
  rep(i, n) rep(j, n) cin >> c[i][j], c[i][j]--;

  rep(i, n) rep(j, n) rep(col, C) pre[(i + j) % 3][col] += d[c[i][j]][col];

  int ans = 1 << 30;
  rep(c0, C) rep(c1, C) rep(c2, C) if (!(c0 == c1 || c0 == c2 || c1 == c2))
      ans = min(ans, pre[0][c0] + pre[1][c1] + pre[2][c2]);

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

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

int main(){

	int N;
	cin >> N;
	string W[N];
	int count = 0;
	for(int i = 0; i < N; i++){
		cin >> W[i];
	}
	for(int j = 0; j < N; j++){
		for(int k = 0; k < N; k++){
			if(j != k){
				if(W[j] == W[k]){
					count = 1;
				}
			}
		}
	}
	int ans = 0;
	for(int l = 1; l < N; l++){
		const size_t len = W[l-1].length();
		if(W[l-1].substr(len-1,1) != W[l].substr(0,1)){
			ans = 1;
		}
	}
	if(count == 1){
		cout << "No" << endl;
	}
	else if(ans == 1){
		cout << "No" << endl;
	}
	else{
		cout << "Yes" << endl;
	}

}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int A;
  int B;
  int C;
  scanf("%d",&A);
  scanf("%d",&B);
  scanf("%d",&C);
  if(A+B+C>=22){
    printf("bust");
  }
  if(A+B+C<=21){
    printf("win");
  }
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
#include <string>
#include <vector>
#include <algorithm>
#include <map>
typedef long long ll;
#include <cmath>
#include <iomanip>

const int MOD = 1000000007;



int main(int argc, char *argv[])
{
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	
	ll ret=a*c,ad=a*d,bc=b*c,bd=b*d;
	if (ad>ret) ret=ad;
	if (bc>ret) ret=bc;
	if (bd>ret) ret=bd;

	cout<<ret<<endl;
	return 0;
}



Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
const long long M =1e5+2,MOD=1e9+7;
typedef long long ll;
#define pb push_back
#define Y printf("YES\n")
#define N printf("NO\n")
#define O printf("-1\n")
bool f_2=false,vis[M]= {false},f=false;
vector<ll>v,v_1,v_2;
string s,p,q,ok,ch;
map<ll,ll>mp,mp_2;
set<ll>st,st_1;
ll arr[M],ar[M];
ll cnt=0,cost=0,mx=0,NODE,t,par,zero=0;
deque<ll>Q;
//vector< pair<ll,ll > >v,v_1;
struct node
{
    ll pa,ran,visit;

};
//node X[M];
int main()
{
    ios::sync_with_stdio(false);//ISHWAR
    cin.tie(0);//Tourist_Twin
    //freopen("kamona.txt","r",stdin);
    ll a,b,c=1,n,t,sum=0,mx=0,l,x,y,i=0,j=0,result=0,e,sum_2,sum_1=0,d=0,k,mx_2=0,pos=0,neg=0,m,second=0;
    cin>>t>>s;
    if(t>=3200)cout<<s<<endl;
    else cout<<"red"<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int i[100];
	int j;
	int max = 0;
	int min = 0;
	
	cin >> j;
	for (int a = 0; a < j; a++){
		cin >> i[a];
	}
	for (int a = 0; a < j; a++){
		if (a == 0){
			max = i[a];
			min = i[a];
		}
		else{
			if (max < i[a]){
				max = i[a];
			}
			if (min > i[a]){
				min = i[a];
			}
		}
	}
	cout << max - min << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
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);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    int N; cin >> N;

    vector<ll> A(N+2);
    for(int i = 1; i <= N;i++){
        cin >> A[i];
    } 
    A[0] = INF;
    A[N+1] = -INF;

    res = 1000;
    ll have = 0;
    for(int i = 1; i <= N-1;i++){
        if(A[i] < A[i+1]){
            have = res/A[i];
            res = res + A[i+1]*have - A[i]*have;
        }
    }
    
    return res;
}
int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    //solve<ll>(0);
    cout << fixed << setprecision(12) << solve<ll>() << endl;
    return 0;
}

Measured memory_bytes: 3516
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner  sc = new Scanner(System.in);
		// input
		int n = Integer.parseInt(sc.next());
		int[] a = new int[n];
		Set<Integer> task = new HashSet<>();
		for(int i=0; i<n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}
		// 同じ構造でもArrayListだとTLEで死ぬ
		for (int i = 0; i < a.length; i++){
		    if(task.contains(a[i])) {
		    	System.out.println("NO");
		    	return;
		    }
		    task.add(a[i]);
		}
		System.out.println("YES");		
	}
}

Measured memory_bytes: 53276
#include <iostream>

using namespace std;

int const N = 1e5 + 10;
int fr[N];

int main() {
  
  int n, tmp;
  cin >> n;
  
  for (int i = 0; i < n; ++i) {
    cin >> tmp;
    ++fr[tmp + 1];
  }
  
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    if (fr[i] != 0) {
      ans = max(ans, fr[i - 1] + fr[i] + fr[i + 1]);
    }
  }

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

Measured memory_bytes: 640
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		char[] str = sc.next().toCharArray();
		int p = 0;
out:		for(int i = 0; i < str.length; i++) {
			for(int j = i + 1; j < str.length; j++) {
				if(str[i] == str[j]) {
					System.out.println("no");
					p = 1;
					break out;
				}
			}
			
		}
		if(p == 0) System.out.println("yes");
	}

}


Measured memory_bytes: 21076
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] l = new int[n];
		for (int i = 0; i < n; i++) {
			l[i] = sc.nextInt();
		}
		sc.close();

		int max = 0;
		int sum = 0;
		for (int i = 0; i < n; i++) {
			max = Math.max(max, l[i]);
			sum += l[i];
		}
		if (sum - max > max) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21844
extern crate core;

use std::io::{self, Read};

#[macro_use]
mod parser {
    macro_rules! input {
    ($s:expr=>$($t:tt)*) => {
        let mut lines=$s.split("\n");
        $(
            line_parse!(lines,$t);
        )*
    };
    }

    macro_rules! line_parse {
    ($lines:expr,($($name:ident:$t:tt)*)) => {
        let mut line=$lines.next().unwrap().split_whitespace();
        $(value_def!(line,$name,$t);)*
    };

    //複数行
    ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
        values_def!($lines,$n,$name,$t);
    };
    }

    macro_rules! value_def {
    ($line:expr,$name:ident,$t:tt) => {
        let $name=value!($line,$t);
    };
    }

    macro_rules! values_def {
    ($lines:expr,$n:expr,$name:ident,$t:tt) => {
        let $name={
        let mut vec=Vec::new();
        for i in 0..$n{
            let mut next=$lines.next().unwrap().split_whitespace();
            vec.push(value!(next,$t));
        }
        vec
        };
    };
    }

    macro_rules! value {
    //配列
    ($line:expr,[$t:tt]) => {
        $line.map(|x|{
        let mut iter=::std::iter::once(x);
        value!(iter,$t)
        }).collect::<Vec<_>>()
    };
    //タプル
    ($line:expr,($($t:tt),*)) => {
        ($(value!($line,$t),)*)
    };
    //文字列
    ($line:expr,#) => {
        $line.next().unwrap()
    };
    //単一値
    ($line:expr,$t:ty) => {
        $line.next().unwrap().parse::<$t>().unwrap()
    };
    }
}

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = solve(input.trim().to_string());
    println!("{}", output);
}

fn solve(input: String) -> String {
    let mut v = input.chars().collect::<Vec<_>>();
    v.sort();
    if v == vec!['a', 'b', 'c'] {
        "Yes"
    } else {
        "No"
    }.to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}

tests! {
    test1: "bac" => "Yes",
    test2: "bab" => "No",
    test3: "abc" => "Yes",
    test4: "aaa" => "No",
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>

#define DIV 998244353

using namespace std;
using ll = long long;
using ldb = long double;


int main() {
	int N; cin >> N;
	map<int, int> mp;
	for (int i = 0; i < N; i++) {
		int a; cin >> a;
		mp[a]++;
	}
	int ans = 0, odd = 0;
	for (auto x : mp) {
		ans++;
		if (x.second % 2 == 0) odd++;
	}
	
	cout << max(1,ans-(odd%2)) << endl;
	
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin>>n;
	int a[n+1];
	int b[n+1]={};
	for(int i=1;i<=n;i++)cin>>a[i];
	n=1;
	b[n]=1;
	int count=0;
	while(n!=2){n=a[n];if(b[n]){cout<<-1<<"\n";return 0;}b[n]=1;count++;}
	cout<<count<<"\n";
	return 0;
}

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

using namespace std;

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

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

int main(){

    int a,b;
    cin>>a>>b;

cout<<a*b<<"\n";

    return 0;

}

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

int main(void){
  int n,m,ac,pen;
  int solved[100010]={0};
  int waCnt[100010]={0};
  
  cin >> n >> m;
  for (int i=0; i<m; i++){
    int p;
    string s;
    cin >> p >> s;
    if (s[0]=='A'){ // AC
      solved[p] |= 1;
    } else { // WA
      waCnt[p] += !solved[p];
    }
  }
  ac = pen = 0;
  for (int i=1; i<=n; i++){
    ac += solved[i];
    pen += solved[i]*waCnt[i];
  }
  cout << ac << " " << pen << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
#define No cout<<"No"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    ll ans=0;
    int n;cin>>n;
    rep(i,n){
        int l,r;
        cin>>l>>r;
        ans+=r-l+1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
using namespace std;
typedef long long int ll;
ll cnt=0;
bool is_prime(ll n) {
    if(n == 1) return false; // 1 は素数ではない。
    for(ll i = 2; i*i <= n; ++i) { // 2 <= i <= sqrt(n) に約数があれば、
        if(n % i == 0) return false; // n は素数ではない
    }
    return true;
}
std::pair<std::vector<ll>, std::vector<ll>> prime_factor_decomp(ll n) {
    std::vector<ll> p, e;
    ll m = n;
    for (ll i = 2; i * i <= n; i++) {
        if (m % i != 0) continue;
        int c = 0;
        while (m % i == 0) c++, m /= i;
        p.push_back(i);
        e.push_back(c);
        cnt++;
    }
    if (m > 1) {
        p.push_back(m);
        e.push_back(1);
        cnt++;
    }
    return std::make_pair(p, e);
}
int main(){
  ll n,p;
  cin >>n>>p;
  if(n==1) cout<<p<<endl;
  else if(is_prime(p)) cout <<1<<endl;
  else{
    pair <vector<ll>,vector<ll>> v=prime_factor_decomp(p);
    ll ans=1;
    for(ll i=0;i<cnt;i++){
      if(v.second[i]>=n){
        ll k=v.second[i]/n,p=1;
        for(ll j=0;j<k;j++) p*=v.first[i];
        ans*=p;
      }
    }
    cout <<ans<<endl;
  }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, e) for (int i = s; i < e; ++i)
#define sort_(a) stable_sort(a.begin(), a.end())
#define rsort(a) stable_sort(a.rbegin(), a.rend())
#define sum(a) accumulate(a.begin(), a.end(), 0LL)
#define join(a, d) accumulate(a.begin() + 1, a.end(), a[0], [](string s, string t) {return s + d + t;})
#define all(a) a.begin(), a.end()
// #define __lcm(a, b) std::__detail::__lcm(a, b)
typedef long long ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(0);

  string C1, C2;
  cin >> C1 >> C2;
  rep(i, 0, 3) {
    int j = 2 - i;
    if (C1[i] != C2[j]) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}


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

const long long MOD = 1000000007;

int N, K;
std::vector<std::vector<int>> g;
std::vector<bool> check;

long long dfs(int u, int d) {
    long long res = 1;
    int color = std::max(0, K - std::min(2, d + 1)) % MOD;

    for (int v : g[u])
        if (!check[v]) {
            check[v] = true;
            res = res * (color * dfs(v, d + 1) % MOD) % MOD;
            color--;
        }

    return res;
}

int main() {
    std::cin >> N >> K;

    g.resize(N);
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        std::cin >> a >> b;

        g[a - 1].push_back(b - 1);
        g[b - 1].push_back(a - 1);
    }

    check.resize(N);
    check[0] = true;

    std::cout << K * dfs(0, 0) % MOD << "\n";
}

Measured memory_bytes: 10368
//Volume2-0231
import java.util.*;

class Token implements Comparable<Token>{
	public  int ope;
	public  int weight;
	private int time;
	Token(int o,int m,int t){
		this.ope=o; this.weight=m; this.time=t;
	}
	public int compareTo(Token t){
		int ret;
		ret = this.time - t.time;
		if(ret==0){
			ret = this.ope - t.ope;
		}
		return ret;
	}
}

class Main {
	
	//declare
	private static ArrayList<Token> ar = new ArrayList<Token>();
	
	public static void main(String[] args){
		
		int    n,m,sum;
		String result;
		
		//input
		Scanner sc = new Scanner(System.in);
		while((n=sc.nextInt())!=0){
			ar.clear();
			while(n-- > 0){
				m = sc.nextInt();
				ar.add(new Token( 1,m,sc.nextInt()));
				ar.add(new Token(-1,m,sc.nextInt()));
			}
			
			//calculate			
			Collections.sort(ar);
			sum=0; result="OK";
			for(Token t:ar){
				sum += t.weight * t.ope;
				if(sum>150){
					result="NG";
					break;
				}
			}
			//output
			System.out.println(result);
		}
	}
}

Measured memory_bytes: 57480
#include<stdio.h>

int len(char s[1000]) {
	int i = 0;
	while (1) {
		if (s[i] == 0) return i;
		i++;
	}
}

int main() {
	char t[2000] = { 0 }, p[2000] = { 0 };
	int tl, pl;
	scanf("%s", t);
	scanf("%s", p);
	tl = len(t);
	pl = len(p);
	for (int i = 0; i < tl;i++) {
		int j = 0;
		for (; j < pl; j++) {
			if (t[i + j]!=p[j]) break;
		}
		if (pl == j) printf("%d\n", i);
	}
	return 0;
}


Measured memory_bytes: 2728
#include<bits/stdc++.h>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
typedef pair<int,int>P;
typedef pair<int,P>P2;
#define F first
#define S second

signed main(){
  int n;
  cin>>n;
  int a[n+1];
  r(i,n+1)cin>>a[i];
  int b[n];
  r(i,n)cin>>b[i];
  int sum=0;

  r(i,n){
    sum += min(a[i],b[i]);
    b[i] = max(0LL,b[i]-a[i]);
    sum += min(a[i+1],b[i]);
    a[i+1] = max(0LL,a[i+1]-b[i]);
  }

  cout<<sum<<endl;

}


Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

import static java.lang.Integer.parseInt;

/**
 * Problem D: Distorted Love
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			int n = parseInt(line);
			if (n == 0) break;

			//????????¨??????
			br.readLine();

			Map<String, Map<int[], String>> pages = new HashMap<>();
			Deque<String> stackF, stackB;
			stackF = new ArrayDeque<>();
			stackB = new ArrayDeque<>();

			for (int i = 0; i < n; i++) {
				words = br.readLine().split(" ");

				String name = words[0];
				int b = parseInt(words[1]);

				pages.put(name, new HashMap<>());

				for (int j = 0; j < b; j++) {
					words = br.readLine().split(" ");
					int[] pos = new int[4];
					for (int k = 0; k < 4; k++) {
						pos[k] = parseInt(words[k]);
					}
					pages.get(name).put(pos, words[4]);
				}
				if (i == 0) {
					stackF.push(name);
				}
			}

			int m = parseInt(br.readLine());

			for (int i = 0; i < m; i++) {
				words = br.readLine().split(" ");

				String op = words[0];

				switch (op) {
					case "click":
						int x = parseInt(words[1]);
						int y = parseInt(words[2]);
						String page = stackF.peek();
						Map<int[], String> btns = pages.get(page);
						for (int[] btn : btns.keySet()) {
							if (btn[0] <= x && x <= btn[2]
									&& btn[1] <= y && y <= btn[3]) {
								stackF.push(btns.get(btn));
								stackB.clear();
							}
						}
						break;
					case "back":
						if (stackF.size() > 1) {
							stackB.push(stackF.pop());
						}
						break;
					case "forward":
						if (!stackB.isEmpty()) {
							stackF.push(stackB.pop());
						} break;
					case "show":
						System.out.println(stackF.peek());
						break;
				}
			}
		}
	}
}

Measured memory_bytes: 28444
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
ll MAX(ll a,ll b,ll c){return max(a,max(b,c));}
ll MIN(ll a,ll b,ll c){return min(a,min(b,c));}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int card[3][3];
    bool seen[3][3]={false};
    rep(i,3){
        rep(j,3){
            cin >> card[i][j];
        }
    }
    int n;
    cin >> n;
    rep(i,n){
        int x;
        cin >> x;
        rep(i,3){
            rep(j,3){
                if(card[i][j] == x) seen[i][j] = true;
            }
        }
    }
    bool ans = false;
    rep(i,3){
        if(seen[i][0]&&seen[i][1]&&seen[i][2]) ans = true;
        else if(seen[0][i]&&seen[1][i]&&seen[2][i]) ans = true;
    }
    if(seen[0][0]&&seen[1][1]&&seen[2][2]) ans = true;
    if(seen[0][2]&&seen[1][1]&&seen[2][0]) ans = true;
    ans ? cout << "Yes" << endl : cout << "No" << endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
t = 0
left = 0
for i in range(N):
    a = A[i] - left
    b = B[i]
    if a>=b:
        t += b
        left = 0
    else:
        diff = b - a
        pos = A[i+1]
        if diff>=pos:
            t += pos
            left = pos
        else:
            t += diff
            left = diff
        t += a
print(t)

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

const int N = 2e6;

main() {
	clog << "Ready\n";
	
	int x = 0, y = 753;
	string s;
	cin >> s;
	#define sz(s) (int)(s.size())
	for (int i = 0; i < sz(s) - 2; ++ i) {
		int d = (s[i] - '0') * 100 + (s[i + 1] - '0') * 10 + (s[i + 2] - '0') * 1;
		x = abs(d - 753);
		if (y > x)
			y = x;
	}

	cout << y;
	
	cerr << '\n';

	return 0;
}


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

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


int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N) cin >> A[i];

    int max_idx, next_max_idx;
    int tmp = 0;
    REP(i, N){
        if(tmp < A[i]){
            tmp = A[i];
            max_idx = i;
        }
    }
    tmp = 0;
    REP(i, N){
        if(i != max_idx and tmp < A[i]){
            tmp = A[i];
            next_max_idx = i;
        }
    }
    REP(i, N){
        if(i == max_idx) cout << A[next_max_idx] << endl;
        else cout << A[max_idx] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 2432
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int num = Integer.parseInt(br.readLine());

		String[] vectorX = br.readLine().split(" ");
		String[] vectorY = br.readLine().split(" ");

		double distanceP1 = 0;
		double distanceP2 = 0;
		double distanceP3 = 0;
		double max = 0;
		double p1 = 1;
		double p2 = 2;
		double p3 = 3;

		for(int i = 0; i < num;i++){
			double convertX = Double.parseDouble(vectorX[i]);
			double convertY = Double.parseDouble(vectorY[i]);
			double vectorElement = Math.abs(convertX - convertY);

			distanceP1 += Math.pow(vectorElement, p1);
			distanceP2 += Math.pow(vectorElement, p2);
			distanceP3 += Math.pow(vectorElement, p3);
			max = Math.max(max, vectorElement);
		}
		System.out.printf("%.6f\n", Math.pow(distanceP1, 1.0/p1));
		System.out.printf("%.6f\n", Math.pow(distanceP2, 1.0/p2));
		System.out.printf("%.6f\n", Math.pow(distanceP3, 1.0/p3));
		System.out.printf("%.6f\n", max);

		br.close();
	}
}

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

int main() {
    long long N, M;
    cin >> N >> M;
    vector<long long> A(N);
    for (int i = 0; i < N; i++)
        cin >> A[i];

    vector<long long> B(N + 1);
    B[0] = 0;
    for (int i = 1; i <= N; i++) {
        B[i] = A[i - 1] + B[i - 1];
    }

    unordered_map<int, int> hash;
    for (int i = 0; i <= N; i++) {
        hash[B[i] % M]++;
    }

    long long res = 0;
    for (auto it = hash.begin(); it != hash.end(); it++) {
        pair<int, int> p = *it;
        res += (long long)p.second * (p.second - 1) / 2;
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 5260
N = int(input())
A = list(map(int, input().split()))

counts = {i+1: 0 for i in range(N)}

for i in range(N):
    counts[A[i]] += 1

S = 0

for v in counts.values():
    S += v*(v-1)//2

for i in range(N):
    print(S-counts[A[i]]+1)


Measured memory_bytes: 99148
MOD = 1000000007

n, m = [int(i) for i in input().split()]
oks = [True] * (n + 1)
for i in range(m):
    a = int(input())
    oks[a] = False

dp = [0] * (n + 1)
dp[0] = 1
# i=now, j=next
for i in range(n):
    for j in range(i+1, min(n, i + 2) + 1):
        if not oks[j]:
            continue
        dp[j] += dp[i]
        dp[j] %= MOD

print(dp[n])


Measured memory_bytes: 7828
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<map>
#include<bitset>
#include<stack>
#include<set>
#include<vector>
#include <time.h>
#include<string.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const int maxn = 55;
const int Mod=1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double e=exp(1);
const db PI = acos(-1);
const db ERR = 1e-10;

#define Se second
#define Fi first
#define pb push_back
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<" "<<#x3<<" = "<<x3<<endl
int a[maxn][maxn];
struct mat
{
    ll jz[55][55];
};
mat mat_mul(mat x,mat y)
{
    mat res;
    memset(res.jz,0,sizeof(res.jz));
    for(int i=0;i<55;i++)
        for(int j=0;j<55;j++)
            for(int k=0;k<55;k++)
                res.jz[i][j]=(res.jz[i][j]+x.jz[i][k]*y.jz[k][j]+Mod)%Mod;
        return res;
}
int n;
ll power_mod (ll P)//.res是系数矩阵,ans是变换矩阵!!左->ans,右->res.!!
{
    mat ans,res;
    memset(ans.jz,0,sizeof(ans.jz));
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            res.jz[i][j]=a[i][j];
        }
    }
    for(int i=0;i<n;i++) ans.jz[0][i]=1;
    while(P>0)
    {
        if(P&1)  ans=mat_mul(ans,res);//所以应该答案矩阵在左ans,res);
        P=P>>1;
        res=mat_mul(res,res);
    }
    ll anss=0;
    for(int i=0;i<n;i++) anss=(anss+ans.jz[0][i])%Mod;
    return anss;//返回指定位置元素
}

int main()
{
    //ios::sync_with_stdio(false);
    //freopen("a.txt","r",stdin);
    //freopen("b.txt","w",stdout);
    ll k;
    scanf("%d%lld",&n,&k);
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            scanf("%d",&a[i][j]);
        }
    }
    printf("%lld\n",power_mod(k));
    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}



Measured memory_bytes: 384
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define pb push_back
#define sz(s) ((int) ((s).size()))

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

typedef long long ll;
typedef long double ld;

const int inf = (int) 1.01e9;
const ld eps = 1e-11;
const ld pi = acos(-1.0L);

mt19937 mrand(random_device{} ());
int rnd(int x) {
  return mrand() % x;
}

const int mod = (int) 1e9 + 7;

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

int sum(int x, int y) {
  add(x, y);
  return x;
}

int mult(int x, int y) {
  return (ll) x * y % mod;
}

int power(int x, ll p) {
  int res = 1;
  while (p) {
    if (p & 1) {
      res = mult(res, x);
    }
    x = mult(x, x);
    p >>= 1;
  }
  return res;
}

int inv(int x) {
  return power(x, mod - 2);
}

void precalc() {
}

const int maxn = 1e5 + 100;

int n, c, k;
int t[maxn];

bool read() {
  if (scanf("%d%d%d", &n, &c, &k) < 3) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", t + i);
  }
  return true;
}

void solve() {
  sort(t, t + n);
  int res = 0;
  for (int i = 0; i < n; ) {
    int i0 = i;
    while (i - i0 < c && i < n && t[i] <= t[i0] + k) {
      i++;
    }
    res++;
  }
  printf("%d\n", res);
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen("text.in", "r", stdin));
  assert(freopen("text.out", "w", stdout));
#endif

  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time: %.3f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}



Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#include <fstream>
#include <iterator>

// #include "prettyprint.hpp"

using namespace std;
typedef long long ll;
// vector<vector<int>> vvi;
// vvi = vector<vector<int>>(20, vector<int>(10, 0));

int main()
{
    string S;
    cin >> S;
    string T = "ATCG";
    int ans = 0;
    for (int i = 0; i < S.size(); ++i)
    {
        int now = 0;
        for (int j = i; j < S.size(); ++j)
        {
            bool flag = false;
            for (int k = 0; k < T.size(); ++k)
            {
                if (S[j] == T[k])
                {
                    flag = true;
                }
            }
            if (flag)
            {
                ++now;
                ans = max(ans, now);
            }
            else
            {
                break;
            }
        }
    }
    cout << ans << endl;
}

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

int main()
{
    int a[101];
    int n;
    int i;
    int f=1;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++)
    {
        if(a[i]%2==0)
        {
            if(a[i]%3!=0&&a[i]%5!=0)
            {
                f=0;
                break;
            }
        }
    }
    if(f==1)
        printf("APPROVED");
    else
        printf("DENIED");
    return 0;
}


Measured memory_bytes: 256