akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>

using namespace std;

using ull = unsigned long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vull = vector<ull>;
using vpii = vector<pii>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define rFOR(i,a,b) for(int i=(b);i>=(a);i--)
#define SORT(a) sort((a).begin(),(a).end());
#define rSORT(a) sort((a).rbegin(),(a).rend());
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;

//sankou
//vvi = vector<vector<int>>(20, vector<int>(10, 0));

int isP(int n) {
    if(n<=1) return 0;
    FOR(i,2,(int)sqrt(n)) {
        if(n%i==0) return 0;
    }
    return 1;
}

int main() {
    
    int A,B,K;
    cin >>A>>B>>K;
    
    FOR(i,A,min(A+K-1,B)) {
        cout <<i<<endl;
    }

    FOR(i,max(A+K,B-K+1),B) {
        cout <<i<<endl;
    }

    return 0;
}








Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline bool chmin(A &a,const B &b){if(a>b){a=b;return true;}else{return false;}}
template<typename A,typename B>inline bool chmax(A &a,const B &b){if(a<b){a=b;return true;}else{return false;}}

const ll INF = 1LL << 60;
const ll MOD = 1e9+7;

int main()
{
    string A,B,C;
    cin >> A >> B >> C;
    queue<char> qA,qB,qC;
    for(auto a:A){
        qA.push(a);
    }
    for(auto b:B){
        qB.push(b);
    }
    for(auto c:C){
        qC.push(c);
    }
    bool flag = true;
    char now = qA.front();
    qA.pop();
    string ans;
    while(flag){
        switch(now){
        case 'a':
            if(qA.empty()){
                ans = "A";
                flag = false;
            }else{
                now = qA.front();
                qA.pop();
            }
            break;
        case 'b':
            if(qB.empty()){
                ans = "B";
                flag = false;
            }else{
                now = qB.front();
                qB.pop();
            }
            break;
        case 'c':
            if(qC.empty()){
                ans = "C";
                flag = false;
            }else{
                now = qC.front();
                qC.pop();
            }
            break;
        default:
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3604
/*
 * Author: FreeIdea
 * Created Time:  2011/8/22 12:39:40
 * File Name: k.cpp
 */
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
using namespace std;
const int maxint = -1u>>1;
template <class T> bool get_max(T& a, const T &b) {return b > a? a = b, 1: 0;}
template <class T> bool get_min(T& a, const T &b) {return b < a? a = b, 1: 0;}

int r, c;


int main() {
    while(scanf("%d%d", &r, &c) == 2) {
        if(r == 0 && c == 0)    break;
        if((r * c) % 2) printf("no\n");
        else    printf("yes\n");
    }
    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;
/* ちゃんと考えてわかって実装 */

int main(void){
    ll n, k;
    cin >> n >> k;
    cout << min(n%k, abs((-n)%k + k)) << endl;
    return 0;
}

Measured memory_bytes: 256
import numpy as np
U = 10**5+10
T = np.zeros(U, np.bool)
T[1] = 1
T[2] = 1
T[3::2] = 1
for i in range(3,U,2):
  if i*i>U:
    break
  if T[i]:
    T[i*i::i+i] = 0
A = np.zeros(U, np.bool)
for i in range(3,U,2):
  if T[i]==1 and T[(i+1)//2]==1:
     A[i] = 1
A[1] = 0
A[2] = 0
A = A.cumsum()
    
Q = int(input())
for i in range(Q):
  l, r = map(int, input().split())
  print(A[r]-A[l-1])

Measured memory_bytes: 14168
w=["dreameraser","dreamerase","dreamer","eraser","dream","erase"]
a=gets.chomp
t=[]
c=0
while a!=[] do
  b=a.index(w[c])
  if b==0
  	t.push(w[c])
  	a.slice!(0...w[c].length)
    if a==""
      puts "YES"
      break
    end
    c=0
    redo
  end
  c+=1
  if c==6
    puts "NO"
  	break
  end
end


Measured memory_bytes: 74492
#include<stdio.h>

int N,A[100],c=0,i,j;

int main()
{
	for(i=0,scanf("%d",&N);i<N;scanf("%d",&A[i++]));
	for(i=0;i<N-1;i++)
		for(j=N-1;j>i;j--)
			if(A[j]<A[j-1])
			{
				c++;
				A[j]^=A[j-1]^=A[j]^=A[j-1];
			}
	for(i=0;i<N;i++)
		printf("%d%s",A[i],i==N-1?"\n":" ");
	printf("%d\n",c);
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define MAXN 100005
#define Mid ((l+r)>>1)
#define lson rt<<1,l,Mid
#define rson rt<<1|1,Mid+1,r

long long arr[MAXN << 2], lazy[MAXN << 2];

inline void push_up(long long rt)
{
	arr[rt] = arr[rt << 1] + arr[rt << 1 | 1];
}

void build(long long rt, long long l, long long r)
{
	if (l == r)arr[rt] = 0;
	else{
		build(lson);
		build(rson);
		push_up(rt);
	}
}


inline void f(long long rt, long long l, long long r, long long k)
{
	lazy[rt] += k;
	arr[rt] += k * (r - l + 1);//该区间统一改变、所以arr加上元素个数
}

inline void push_down(long long rt, long long l, long long r)
{
	f(rt << 1, l, Mid, lazy[rt]);
	f(rt << 1 | 1, Mid + 1, r, lazy[rt]);
	lazy[rt] = 0;
}

inline void updata(long long rt, long long l, long long r, long long L, long long R, long long k)
{
	if (l >= L && r <= R){
		arr[rt] += k * (r - l + 1);
		lazy[rt] += k;
	}else{
		push_down(rt, l, r);
		if (L <= Mid)updata(lson, L, R, k);
		if (R > Mid)updata(rson, L, R, k);
		push_up(rt);
	}
}

long long query(long long rt, long long l, long long r, long long L, long long R)
{
	long long res = 0;
	if (L <= l && R >= r)return arr[rt];
	push_down(rt, l, r);
	if (L <= Mid)res += query(lson, L, R);
	if (R > Mid)res += query(rson, L, R);
	return res;
}

int main()
{
	long long n, q, ch, a, b, c;
	scanf("%lld%lld", &n, &q);
	build(1, 1, n);
	while (q--){
		scanf("%lld", &ch);
		if (ch){
			scanf("%lld%lld", &a, &b);
			printf("%lld\n", query(1, 1, n, a, b));
		}else{
			scanf("%lld%lld%lld", &a, &b, &c);
			updata(1, 1, n, a, b, c);
		}
	}
	return 0;
}


Measured memory_bytes: 7332
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cstring>
#include <utility>
#include <map>
#include <queue>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;

int main()
{
    string s;
    ll k;
    cin>>s>>k;
    
    ll ans=0;
    ll cnt=0;
    for(int i=0;i<s.length()-1;)
    {
        if(s[i]==s[i+1])
        {
            cnt++;
            i+=2;
        }
        else
            i++;
    }
    //unsigned long x=s.length();
    string h=s+s;
    ll cnt1=0;
    for(int i=0;i<h.length()-1;)
    {
        if(h[i]==h[i+1])
        {
            cnt1++;
            i+=2;
        }
        else
            i++;
    }
    ll chg=cnt1-2*cnt;
  //cout<<chg<<endl;
    
        ans=cnt*k+(k-1)*chg;
   // if(k==1)
       // ans=cnt;
    
    sort(s.begin(),s.end());
    if(s[0]==s[s.length()-1]&&s.length()%2!=0&&k>1)
        ans=s.length()*k/2;
    if(s.length()==1)
    {
            ans=k/2;}
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(){
  string s;
  cin >> s;
  if(s.at(s.size()-1) == 's') cout << s << "es" << endl;
  else cout << s << "s" << endl;
}

Measured memory_bytes: 3624
#include<iostream>
#include<map>
#include<string>
#include<set>
using namespace std;

int solve(){
  int n;  cin >> n;
  set<int> st;
  bool ans = true;
  for(int i=0; i<n; i++)  {
    int v; cin >> v;
    if(st.find(v) != st.end()){
      ans = false;
    }
    else{
      st.insert(v);
    }
  }
  cout << (ans ? "YES" : "NO") << endl;
}

int main(){
  solve();
  return 0;
}


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

int main()
{
    int n;

    cin >> n;

    int ans = 0;
    int fans = 1;
    for(int i = 1 ; i<=n ; i++){
            int x = i;
            int c = 0;
    while(x%2==0)
    {
        c++;
        x = x/2;
    }
    if(c>ans)
    {
        ans = c;
        fans = i;
    }
    }
    cout << fans;
    return 0;
}


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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] nk = br.readLine().split(" ");
		int n = Integer.parseInt(nk[0]);
		int k = Integer.parseInt(nk[1]);
		br.readLine();
		// String[] aline = br.readLine().split(" ");

		int count = (n - 1) / (k - 1);
		if (0 < (n - 1) % (k - 1)) {
			count++;
		}

		System.out.println(count);

	}

}


Measured memory_bytes: 25976
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define il inline
#define outy printf("Yes\n")
#define outn printf("No\n")
#define outf printf("First\n")
#define outs printf("Second\n")
#define FOR(a,b,c) for(int a=b;a<=c;a++)
#define FORD(a,b,c) for(int a=b;a>=c;a--)
#define FORL(a,b) for(int a=head[b];a;a=nxt[a])
#define in(a)  a=read()
#define in2(a,b)  a=read(),b=read()
#define in3(a,b,c)  a=read(),b=read(),c=read()
#define in4(a,b,c,d)  a=read(),b=read(),c=read(),d=read()
#define inl(a)  a=readl()
#define inl2(a,b)  a=readl(),b=readl()
#define inl3(a,b,c)  a=readl(),b=readl(),c=readl()
#define inl4(a,b,c,d)  a=readl(),b=readl(),c=readl(),d=readl()
#define out(a) printf("%d\n",a)
#define out2(a,b) printf("%d %d\n",a,b)
#define out3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out4(a,b,c,d) printf("%d %d %d %d\n",a,b,c,d)
#define outl(a) printf("%lld\n",a)
#define outl2(a,b) printf("%lld %lld\n",a,b)
#define outl3(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define outl4(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define clr(x,y) memset(x,y,sizeof(x))
inline int read(){
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
inline ll readl(){
    char c;ll s=0;int t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
/*------------------------------------------------------------*/
#define mod 1000000007
#define maxn 1
/*------------------------------------------------------------*/

int main(){
	string s;
	cin>>s;
	int ans=0;
	FOR(i,0,s.length()-2)
		if(s[i]=='A'&&s[i+1]=='C')ans=1;
	ans?outy:outn;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
m=int(input())
for i in range(m):
	b, m, e = map(int, input().split())
	s = a[b:e]
	a = a[:b] + s[m-b:] + s[:m-b] + a[e:]
print(*a)


Measured memory_bytes: 5832
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
const int maxn=1010;
struct Node
{
	int c,t,value;
}num[maxn];
bool compare(Node a, Node b)
{
	return a.c<b.c;
}
int main()
{
	int n,p;
	scanf("%d%d",&n,&p);
	for(int i=0;i<n;i++)
	{
		scanf("%d%d",&num[i].c,&num[i].t);
	}
	sort(num,num+n,compare);
	for(int i=0;i<n;i++)
	{
		if(num[i].t<=p)
		{
			printf("%d\n",num[i].c);
			break;
		}
		if(i==n-1 && num[i].t>p)
		{
			printf("TLE\n");
		}
	}
	return 0;
}

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

ans1 = 0
ans2 = 0

tmp = 0
for i in range(N): # even -> positive
    a = A[i]
    tmp += a
    if i % 2 == 0:
        if tmp <= 0:
            ans1 += abs(tmp) + 1
            tmp = 1
    else:
        if tmp >= 0:
            ans1 += abs(tmp) + 1
            tmp = -1

tmp = 0
for i in range(N): # even -> positive
    a = A[i]
    tmp += a
    if i % 2 != 0:
        if tmp <= 0:
            ans2 += abs(tmp) + 1
            tmp = 1
    else:
        if tmp >= 0:
            ans2 += abs(tmp) + 1
            tmp = -1

ans = min(ans1,ans2)
print(ans)


Measured memory_bytes: 14468
// Created by code_sm
//
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp> 
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> pseudo_set;
#define ll long long
#define vi vector<int>
#define si set<int> 
#define mii map<int,int>
#define pb push_back
#define pf push_front
#define pii pair<int,int>
#define extract_word(s)  stringstream str(s); while(str>>word)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define SET(s) cout<<fixed<<setprecision(s)
#define chotu 1000000007
#define set0(a) memset(a,0,sizeof(a))
#define endl "\n"
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lower_string(s) transform(all(s),s.begin(),::tolower())
#define upper_string(s) transform(all(s),s.begin(),::toupper())
#define size(s) s.size()
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
template<typename T,typename U>
bool compare(T x,U y){return(abs(x-y)<=1e-9);}
void solve()
{
fastio
string s,t;
cin>>s>>t;
int n=size(s);
int cnt=0;
for(int i=0;i<n;i++)
{
	if(s[i]!=t[i])
		cnt++;
}
cout<<cnt;
}
int main()
{
//code
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
fastio	
int t;
t=1;
while(t--)
{
	solve();
	cout<<endl;
}
}


Measured memory_bytes: 3732
# input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
# import functools
# import itertools
# import math
N=int(input())
VUW=[list(map(int,input().split())) for i in range(N-1)]
data=[[] for i in range(N+1)]
nagasa={}
for v,u,w in VUW:
    data[v].append(u)
    data[u].append(v)
    v,u=min(v,u),max(v,u)
    nagasa.update({str(v)+" "+str(u):w})
kakutei=set([i for i in range(1,N+1)])
iro=[0 for i in range(N+1)]
#print(nagasa)
#print(data)
itta=set()
st=1
stack=deque([[st,0,st]])
while stack:
    v,m,st=stack.popleft()
    for u in data[v]:
        if not u in itta:
            itta.add(u)
            a,b=min(v,u),max(v,u)
            w=nagasa[str(a)+" "+str(b)]
            M=m+w

            if M%2==1:
                iro[u]=1
            stack.append([u,M,st])

for i in range(1,N+1):
    print(iro[i])


Measured memory_bytes: 118868
#include <iostream>
using namespace std;
int a=0;
int box[22][22]={{}};
int  kazoe(int p,int P,int H,int W){
  int i,I;
  a++;
  box[p][P]=0;
  if(box[p][P+1]==1) kazoe(p,P+1,H,W);
  if(box[p][P-1]==1) kazoe(p,P-1,H,W);
  if(box[p-1][P]==1) kazoe(p-1,P,H,W);
  if(box[p+1][P]==1) kazoe(p+1,P,H,W);
  else {
  return a;
  }
}
int main(){
  int i,I,H,W,p,P;
  
  char v;
  while(1){
  cin>>W>>H;
  for(i=0;i<=H+1;i++){
    for(I=0;I<=W+1;I++){
      box[i][I]=0;
    }
  }
  if(W==0&&H==0) break;
  for(i=1;i<=H;i++){
    for(I=1;I<=W;I++){
      cin>>v;
      if(v=='.') box[i][I]=1;
      if(v=='#') box[i][I]=2;
      if(v=='@') {
	box[i][I]=0;
	p=i;
	P=I;
      }
    }
  }
  cout<<kazoe(p,P,H,W)<<endl;
  a=0;
  }
  return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        var b = ReadLine()[0];

        var dic = new Dictionary<char, char>()
            { { 'A', 'T' }, { 'T', 'A' }, { 'C', 'G' }, { 'G', 'C' } };

        var ans = dic[b];

        WriteLine(ans);
    }
}


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

using namespace std;
//typedef long long ll;
typedef unsigned long long ll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX;
const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;

int main() {
    int k, x;
    cin >> k >> x;

    if (500 * k >= x) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}


Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x==y:
            return False

        if self.parents[x] > self.parents[y]:
            x, y = y, x
        
        self.parents[x] += self.parents[y]
        self.parents[y] = x
        return True

    def size(self, x):
        return -self.parents[self.find(x)]

N, M = map(int, input().split())
ans = 0

UF = UnionFind(N)

for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    UF.union(a,b)

for i in range(N):
    ans = max(ans, UF.size(i))

print(ans)

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

const int INF = 2e9;

int main(){
    int l,r,d;
    cin >> l >> r >> d;
    int ans = r/d - (l-1)/d;
    cout << ans << endl;
}

Measured memory_bytes: 3620
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma comment(linker, "/STACK:2000000")

#include "bits/stdc++.h"

using namespace std;

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
// #define endl '\n'
using ll = long long;
using db = long double;
using ii = pair<int, int>;

const int N = 2e5 + 5, LG = 19, MOD = 998244353;
const int SQ =320;
const long double EPS = 1e-7;
void print(vector<int> v){
  for(auto x : v)cout << x << ' ';
  exit(0);
}
int32_t main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif

  int n;
  cin >> n;
  if(n == 3){
    cout << "2 5 63\n";
    return 0;
  }
  if(n <= 100){
    cout<<2<<' '<<3<<' '<<5<<' '<<20;
    f(i,0,n-4)cout<<' '<<30+i*30; return 0;
  }

  ll tot = 2 + 3 + 5;
  int cnt = n - 4;
  vector<int> v({2,3,5});
  for(int cur = 30000; cnt;--cur){
    if(cur%2==0||cur%3==0||cur%5==0){
      v.push_back(cur);
      cnt--;
      tot += cur;
    }
  }

  for(ll k = 6; k <= 2000;k++){
    if(__gcd(tot,k) != 1 && (tot+k)%30==0){
      v.pb(k);
      print(v);
      return 0;
    }
  }

  if(tot&1){
    v.erase(find(v.begin(),v.end(),30000-3));
    tot-=(30000-3);
  }

  f(i,10,1001)
    f(j,i+1,1001){
      if((tot+i+j)%30==0){
        v.pb(i);
        v.pb(j);
        print(v);
        return 0;
      }
    }
  assert(false);

  return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;

static class CodeJam
{
    class Query
    {
        public readonly char t;
        public readonly char d;
        public Query(string[] args)
        {
            t = args[0][0];
            d = args[1][0];
        }
    }

    static int Go(int i, int N, string s, Query[] queries)
    {
        foreach (var q in queries)
        {
            if (s[i] == q.t)
            {
                switch (q.d)
                {
                case 'L': if (--i < 0) { return -1; } break;
                case 'R': if (++i >= N) { return 1; } break;
                }
            }
        }
        return 0;
    }

    static int Solve(int N, int Q, string s, Query[] queries)
    {
        int l;
        {
            if (Go(0, N, s, queries) >= 0) { l = 0; }
            else if (Go(N - 1, N, s, queries) < 0) { l = N; }
            else
            {
                int ng = 0;
                int ok = N - 1;
                while (ok - ng >= 2)
                {
                    int m = (ng + ok) / 2;
                    if (Go(m, N, s, queries) >= 0) { ok = m; } else { ng = m; }
                }
                l = ok;
            }
        }
        int r;
        {
            if (Go(0, N, s, queries) > 0) { r = -1; }
            else if (Go(N - 1, N, s, queries) <= 0) { r = N - 1; }
            else
            {
                int ok = 0;
                int ng = N - 1;
                while (ng - ok >= 2)
                {
                    int m = (ng + ok) / 2;
                    if (Go(m, N, s, queries) <= 0) { ok = m; } else { ng = m; }
                }
                r = ok;
            }
        }
        return Math.Max(r - l + 1, 0);
    }

    static void Main(string[] args)
    {
        int[] V1 = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int N = V1[0], Q = V1[1];
        var s = Console.ReadLine();
        var queries = new Query[Q];
        for (int i = 0; i < Q; ++i)
        {
            queries[i] = new Query(Console.ReadLine().Split());
        }
        Console.WriteLine(Solve(N, Q, s, queries));
    }
}


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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  rep(i,b){
    if(a*(i+1)%b == c){
      cout << "YES" << endl;
      return 0;
    }
  }
  cout <<"NO" << endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (long long  i=a;i<n;i++)
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define get(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
const int mod = 1e9 + 7;
void solve() {
	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i, 0, n)cin >> a[i];
	vector<ll>  sumj(n + 1, 0);
	vector<ll> sumi(n + 1, 0);
	for (int j = n - 1; j >= 1; j--) {
		sumj[j] = sumj[j + 1] + a[j];
		sumj[j] %= mod;
	}
	for (int i = n - 2; i >= 0; i--) {
		sumi[i] = sumi[i + 1] + a[i] * sumj[i + 1];
		sumi[i] %= mod;
	}
	cout << sumi[0] << endl;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int T_ = 1;
	//cin >> T_;
	for (int i = 0; i < T_; i++)solve();
	return 0;
}



Measured memory_bytes: 7912
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <cmath>
using namespace std;
typedef vector<int> VI;
#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )

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

    string str;
    
    cin >> str;
    reverse(str.begin(), str.end());
    cout << str << endl;
    
    return 0;
}

Measured memory_bytes: 1180
import java.util.*;

public class Main{
	class C implements Comparable<C>{
		int s, e;

		public C(int s, int e) {
			this.s = s;
			this.e = e;
		}

		@Override
		public int compareTo(C o) {
			return this.s - o.s;
		}
		
	}
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int n = sc.nextInt();
			int m = sc.nextInt();
			C [] data = new C[m];
			for(int i = 0; i < m; i++){
				data[i] = new C(sc.nextInt(), sc.nextInt());
			}
			Arrays.sort(data);
			int [] dp = new int[n + 1];
			int INF = 1 << 24;
			Arrays.fill(dp, INF);
			dp[0] = 0;
			
			for(int i = 0; i < m; i++){
				int s = data[i].s;
				int e = data[i].e;
				if(dp[s-1] == INF) continue;
				for(int j = s; j <= e; j++){
					dp[j] = Math.min(dp[j], dp[s-1] + 1);
				}
			}
			System.out.println(dp[n] == INF ? "Impossible" : dp[n]);
		}
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}
}

Measured memory_bytes: 20520
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <atcoder/all>
using namespace std;
using namespace atcoder;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tl3;

typedef modint998244353 mint;

const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
//const ll MOD = 1e9 + 7;
const ll MOD = 998244353;

const ll MAX = 1e9 + 5;


int main() {
	int n, d;
	cin >> n >> d;
	two_sat ts(n);
	vector<int> x(n);
	vector<int> y(n);
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
	}

	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			if (abs(x[i] - x[j]) < d) {
				ts.add_clause(i, false, j, false);
			}
			if (abs(x[i] - y[j]) < d) {
				ts.add_clause(i, false, j, true);
			}
			if (abs(y[i] - x[j]) < d) {
				ts.add_clause(i, true, j, false);
			}
			if (abs(y[i] - y[j]) < d) {
				ts.add_clause(i, true, j, true);
			}
		}
	}

	if (!ts.satisfiable()) {
		cout << "No" << endl;
		return 0;
	}

	cout << "Yes" << endl;
	auto ans = ts.answer();
	for (int i = 0; i < n; i++) {
		if (ans[i]) {
			cout << x[i] << endl;
		}
		else {
			cout << y[i] << endl;
		}
	}
		 
	
}

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

int main(){
	string s;
	cin >> s;
	for(int i=0;i<3;i++){
		if(s[i] == s[i+1]){
			cout << "Bad"<< endl;
			return 0;
		}
	}cout << "Good" << endl;
	return 0;
}


Measured memory_bytes: 256
#0や1のケースに注意
#index out of range

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    mod = 998244353

    n,m,k = map(int, input().split())
    res = 0

    # max_nCrまで調べられる
    max_n = 2*(10**5)
    fac, inv = [1]*(max_n+1), [0]*(max_n+1)
    for i in range(2, max_n+1):
        fac[i] = fac[i-1] * i % mod
    inv[-1] = pow(fac[-1], mod-2, mod)
    for i in range(max_n, 0, -1):
        inv[i-1] = inv[i] * i % mod
    
    # nCrを求める
    def ncr(n, r):
        return fac[n]*inv[r]*inv[n-r]%mod

    for i in range(k+1):
        temp = pow(m-1, n-i-1, mod)
        temp = temp * m % mod
        res += ncr(n-1, i) * temp
        res %= mod
    print(res)



if __name__ == '__main__':
    main()

Measured memory_bytes: 77144
n,m = gets.split.map(&:to_i)
edges = Array.new(n+1).map{[]}
m.times do
  l,r,d = gets.split.map(&:to_i)
  edges[l] << [r,d]
  edges[r] << [l,-d]
end
ans = true
r = 1
que = []
dist = Array.new(n+1,0)
used = Array.new(n+1,true)
used[0] = false
loop do
  for i in r..n
    if used[i]
      r = i+1
      que.push(i)
      used[i] = false
      break
    end
  end
  break if que.empty?
  while !que.empty?
    f = que.shift
    edges[f].each do |v,e|
      if used[v]
        used[v] = false
        dist[v] = dist[f]+e
        que.push(v)
      elsif dist[v] != dist[f]+e
        ans = false
        que = []
        break
      end
    end
  end
end

puts ans ? "Yes" : "No"

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

int main(){
  char a,b,c;
  cin >> a >> b >> c;
  int ans=0;
  if(a=='1')
    ans++;
  if(b=='1')
    ans++;
  if(c=='1')
    ans++;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#define pi 3.14159265358979323846264338
using namespace std;

int main() {
	int n, x;
	while (cin >> n >> x) {
		int ans = 0;
		if (n == 0 && x == 0) {
			break;
		}
		for (int i = 1; i <= n; ++i) {
			for (int j = i + 1; j <= n; ++j) {
				for (int o = j + 1; o <= n; ++o) {
					if (i + j + o == x) {
						ans++;
					}
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3044
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
long long f(vector<double>& a, int x)
{
    long long ret = 0;
    for (int i = 0; i < a.size(); i++) {
        ret += ceil(a[i]/x) - 1;
    }
    return ret;
}
int src(vector<double>& a, int k, int l = 1, int r = 1e9)
{
    int x = (l + r) / 2;
    if (x <= 1) return 1;
    long long fx = f(a, x);
    if (f(a, x-1) > k && fx <= k) return x;
    if (fx > k) return src(a, k, x+1, r);
    else        return src(a, k,   l, x);
}
int main()
{
    int n, k;
    cin >> n >> k;
    vector<double> a(n);
    for (int i = 0; i < n; i++) {
        scanf("%lf", &a[i]);
    }
    cout << src(a, k) << endl;
}

Measured memory_bytes: 4840
#include<stdio.h>
int main(){
  int n,m,i,j;
  scanf("%d %d",&n,&m);
  m/=1000;
  for(i=0;i<=n;i++){
    for(j=0;i+j<=n;j++){
      if((m-i-j*5)==(n-i-j)*10)goto END;
    }
  }
  printf("-1 -1 -1\n");
  return 0;
 END:;
  printf("%d %d %d\n",n-i-j,j,i);     
  return 0;
}


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


#define ll long long
#define int long long
#define pb push_back

#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, a, b) for(int i = (a); i > (b); --i)

typedef pair <int,int> ii;
typedef vector <int> vi;
typedef vector <ii> vii;
typedef vector <ll> vl;

const int mod = 998244353;
const ll inf = 2e18+5;




signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  
    
    int n; string s;
    cin>>n;
    vi a(n);
    loop(i,0,n) cin>>a[i];
    map <int,int> m;
    loop(i,0,n){
        if(m.find(a[i])==m.end())
            m.insert({a[i],1});
        else
            m[a[i]]++;
    }
    int ans=0;

    for(auto x:m){
        
        ans+= x.second*(x.second-1)/2;
    }
    //cout<<ans<<endl;
    int y;
    loop(i,0,n){
        y=ans-(m[a[i]]*(m[a[i]]-1)/2);
        y+=(m[a[i]]-1)*(m[a[i]]-2)/2;
        cout<<max(0LL,y)<<endl;
    }

    return 0;
}   

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

int main() {
int K,S,count=0;
cin>>K>>S;
for(int i=0;i<=K;i++){
for(int j=0;j<=K ;j++){
if(i+j<=S && i+j+K>=S)
count++;
}
}
cout<<count<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void){
 
    int x, y, q, r;
    long long int a,b,z;
 
    while(scanf("%lld %lld", &a, &b)!=EOF){
 
    x = a;
    y = b;
 
    if(x < 0) x = -x;
    if(y < 0) y = -y;
    for(;;){
        q = x/y;
        r = x - q*y;
        if(r == 0) break;
        x = y;
        y = r;
    }
    z=a*b/y;
    printf("%d %lld\n",y,z);
    }
    return 0;
}

Measured memory_bytes: 1724
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.numeric;
import std.stdio;
import std.string;

double n, m, d;
/*
void main()
{
    long[] s = readln().chomp.split(" ").to!(long[]);
    n = s[0];
    m = s[1];
    d = s[2];
    long[] a;
    a.length = m;
    a[] = 1;
    long[] b;
    while (true)
    {
        // stderr.writeln(a);
        b ~= beautiful(a);
        long back;
        for (back = a.length - 1; 0 <= back; --back)
        {
            if (a[back] != n)
            {
                break;
            }
            else
            {
                if (a.all!(e => e == n))
                {
                    goto end;
                }
                a[back .. $] = 1;
            }
        }
        ++a[back];
    }
end:
    stderr.writeln(b);
    writeln(b.sum.to!double / b.length);
}

long[long[]] memo;

long beautiful(in long[] a)
{
    stderr.writeln(a.length);
    auto m = a in memo;
    if (m)
    {
        stderr.writeln(memo.length);
        return *m;
    }
    if (a.all!(e => e == a[0]))
    {
        memo[a.idup] = d == 0 ? a.length : 0;
        return memo[a.idup];
    }
    if (a.length < 2)
    {
        if (abs(a[0] - a[1]) == d)
        {
            memo[a.idup] = 1;
        }
        else
        {
            memo[a.idup] = 0;
        }
        return memo[a.idup];
    }
    long sum = beautiful(a[0 .. $ - 1]);
    if (abs(a[$ - 2] - a[$ - 1]) == d)
    {
        ++sum;
    }
    memo[a.idup] = sum;
    return sum;
}
*/

void main()
{
    double[] s = readln().chomp.split(" ").to!(double[]);
    n = s[0];
    m = s[1];
    d = s[2];
    writefln("%f", ((n - d) * (d == 0 ? 1 : 2) * (m - 1)) / (n * n));
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string n;
	cin >> n;
	int sum = 0;
	for(int i = 0; i < n.size(); i++)
	{
		sum = sum + n[i] - '0';
	}
	if(sum % 9 == 0) cout << "Yes" << endl;
	else cout << "No" <<endl;
	return 0;
}

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

// #undef LOCAL
#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("temp.1", "r", stdin);
  int N, K;
  cin >> N >> K;
  vector<ll> h(N);
  for (int i = 0; i < N; i++) {
    cin >> h[i];
  }
  sort(h.begin(), h.end());
  ll ans = INF;
  dumpv(ans, h);
  for (int i = 0; i <= N - K; i++) {
    ll next = abs(h[i + K - 1] - h[i]);
    dump(ans, next);
    ans = min(ans, next);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <algorithm>
#include <queue>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

inline int getInt(){ int s; scanf("%d", &s); return s; }

using namespace std;

int main(){
  while(true){
    const int n = getInt();
    const int s = getInt();

    if(n + s == 0) break;

    vector<int> r(n);
    REP(i,n) r[i] = getInt();
    sort(r.begin(), r.end());

    int cnt = 0;

    REP(i,n - 1){
      const int p = s - r[i] + 1;
      int ok = r.end() - lower_bound(r.begin() + i + 1, r.end(), p);
      cnt += ok;
    }

    printf("%d\n", cnt);
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <map>
using namespace std;

#define ll long long

int main() {
	int a[4], b[4], c[5][5], d[5];
	bool flag;
	for (int i = 0; i < 3; i++) {
		for (int j = 0;j < 3; j++) {
			cin >> c[i][j];
		}
	}
	for (a[0] = 0; a[0] <= 100; a[0]++) {
		for (a[1] = 0; a[1] <= 100; a[1]++) {
			for (a[2] = 0; a[2] <= 100; a[2]++) {
				d[0] = c[0][0] - c[1][0];
				d[1] = c[1][0] - c[2][0];
				d[2] = c[2][0] - c[0][0];
				if (a[0] - a[1] == d[0] && a[1] - a[2] == d[1] && a[2] - a[0] == d[2]) {
					flag = true;
					for (int i = 0; i < 3; i++) {
						b[i] = c[0][i] - a[0];
						for (int j = 0; j < 3; j++) {
							if (b[i] != c[j][i] - a[j]) {
								flag = false;
								break;
							}
						}
					}
					if (flag) {
						cout << "Yes" << endl;
						return 0;
					}
				}
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

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

int main(){
  int n,a;
  scanf("%d",&n);
  int ball[n];
  int cnt[n+1] = {0};
  long long sum=0;
  rep(i,n){
    scanf("%d",&a);
    ball[i] = a;
    sum += cnt[a];
    cnt[a]++;
  }

  rep(i,n){
    printf("%lld\n",sum-cnt[ball[i]]+1);
  }
}


Measured memory_bytes: 4096
#include <cstdio>
int n,k;
int main(void){
  scanf("%d%d",&n,&k);
  while(n!=0){
    int i;
    int mem[100000]={0};
    for(i=0;i<n;i++){
      scanf("%d",&(mem[i]));
    }
    int ans=0;
    int now=0;
    for(i=0;i<k;i++){
      now+=mem[i];
      ans=now;
    }
    for(i=0;i+k<n;i++){
      now-=mem[i];
      now+=mem[i+k];
      ans=(ans<now)?now:ans;
    }
    printf("%d\n",ans);
    scanf("%d%d",&n,&k);
  }
  return 0;
}

Measured memory_bytes: 1428
n=int(input())
t,a=map(int,input().split())

h=input().split()
h=[int(i) for i in h]

l=[]

for i in range(n):
  l.append((t-h[i]*0.006-a)**2)
m=min(l)
for i in range(n):
  if l[i]==m:
    print(i+1)
  


Measured memory_bytes: 38384
N,M,C = map(int, input().split(' '))
B = list(map(int, input().split(' ')))
A = []
for i in range(N):
  A.append(list(map(int, input().split(' '))))

#正答数
Answer = C
X = 0
for x in range(N):
  for y in range(M):
    Answer += A[x][y]*B[y]
  if Answer > 0:
    X += 1
  Answer = C

print(X)
    

    

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

const int MAXN = 1e3 + 10;
int N;
int A[MAXN];
int ap[MAXN];

int main() {
	register int i;
	scanf("%d", &N);
	for(i = 1; i <= N; ++i)
		scanf("%d", A + i), ++ap[A[i]];
	sort(A + 1, A + N + 1);
	for(i = A[1] + 1; i <= A[N]; ++i)
		if(ap[i] < 2)
			return puts("Impossible"), 0;
	if(ap[A[1]] > 2) return puts("Impossible"), 0;
	if(!(A[N] & 1) && (A[1] == A[2])) return puts("Impossible"), 0;
	if((A[N] & 1) && (A[1] != A[2])) return puts("Impossible"), 0;
	puts("Possible");
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> light(N);
  int a;
  for(int i = 0; i< N ; i++){
  	cin >> a;
    light.at(i) = a;
  }
  int count = 1;
  int check = 0;
  int next = 0;
  for(int i = 0; i < N ; i++){
  	if(light.at(next) == 2){
      check = 1;
      break;
    }
    else{
      count++;
    }
    next = light.at(next) - 1;
  }
  if(check == 1){
    cout << count << endl;
  }else{
  	cout << -1 << endl;
  }
}


Measured memory_bytes: 3796
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
typedef long long ll;
int n;
ll T[100001],A[100001];

ll solve(){
  ll mxT=-1,idxT=0;
  for(int i=0;i<n;i++) if(mxT<T[i])mxT=T[i],idxT=i;
  ll mxA=-1,idxA=0;
  for(int i=n-1;i>=0;i--) if(mxA<A[i])mxA=A[i],idxA=i;
  if(mxA!=mxT)return 0;
  ll ans=1;
  for(int i=1;i<n;i++){
    if(T[i]!=T[i-1]&&T[i]>A[i])return 0;
    if(A[i]!=A[i+1]&&A[i]>T[i])return 0;
    if(T[i]!=T[i-1])continue;
    if(A[i]!=A[i+1])continue;
    ans=ans*min(T[i],A[i])%mod;
  } 
    
  return ans;
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++) cin>>T[i];
  for(int j=0;j<n;j++) cin>>A[j];
 
  cout<<solve()<<endl;

  return 0;
}


Measured memory_bytes: 1920
mod = 998244353
n = gets.to_i
ds = gets.split.map(&:to_i)

if ds[0] != 0
  puts 0
  exit
end

h = Hash.new(0)
mx = -1
ds.each do |d|
  h[d] += 1
  mx = d if d > mx
end

ans = 0
0.upto(mx).each do |i|
  if i == 0
    if h[0] != 1
      puts 0
      exit
    end
  elsif i == 1
    ans = 1
  else
    ans *= (h[i - 1] ** h[i])
    ans %= mod
  end
end
p ans


Measured memory_bytes: 14988
s=list(input())
n = len(s)
#XXがあるか
for i in range(1,n):
    if s[i] == s[i-1]:
        print(i,i+1)
        exit()

#XYXがある場合
if n>=3:
    for i in range(2,n):
        if s[i]==s[i-2]:
            print(i-1,i+1)
            exit()
print(-1,-1)


Measured memory_bytes: 3956
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int a[2001];
int leftless[2001];
int rightless[2001];
long long n, k;
int main() {
	cin >> n >> k;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (i < j && a[i] > a[j]) {
				rightless[i]++;
			} else if (i > j && a[i] > a[j]) {
				leftless[i]++;
			}
		}
	}
	for (int i = 0; i < n; i++) {
		ans += (k - 1) * k / 2 % MOD * (leftless[i] + rightless[i]) % MOD;
		ans %= MOD;
		ans += k * rightless[i] % MOD;
		ans %= MOD;
		//cout << ans << '\n';
	}
	cout << ans << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20);
#define YES cout << "Yes" << endl;
#define NO cout << "No" << endl;
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

int main(){
    long x;
    cin >> x;
    long ans = (x/500)*1000;
    long res = x%500;
    cout << ans + (res/5)*5 << endl;
}


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

using namespace std;

typedef long long ll;

typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;

#define all(x) (x).begin(), (x).end()
#define fi first
#define se second

vector<vector<int>> g;
vector<int> vis;

int dfs(int u,int p = -1){
	vis[u] = 1;
	int su = 1;
	for(auto v : g[u]){
		if(vis[v] || p == v){
			continue;
		}
		su += dfs(v);
	}
	return su;
}


int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin >> n >> m;
    vis.resize(n);
    fill(all(vis),0);
    g.resize(n);
    for(int i=0;i<m;i++){
    	int a,b;
    	cin >> a >> b;
    	a--;
    	b--;
    	g[a].push_back(b);
    	g[b].push_back(a);
    }


    int ans = 0;
    for(int i=0;i<n;i++){
    	if(vis[i]==0){
    		int xx = dfs(i);
    		// cout<<i<<" "<<xx<<"\n";
    		ans = max(ans,xx);
    	}
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 24260
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#define ll long long
using namespace std;
int pos(int n)
{
    if(n<0)
        return 0;
    else
        return n;
}
bool pali(ll n)
{
    char a[10000]= {0};
    int num=0,tn=n;
    for(int i=0; i<tn; i++)
    {
        a[i]=n%10;
        n/=10;
        num=i;
        if(n<=0)
            break;

    }
    for(int i=0; i<num/2; i++)
    {
        if(a[i]!=a[num-i])
        {
            return false;
        }
    }
    return true;
}
int main()
{
    ll a[3];
    for(int i=0; i<3; i++)
    {
        cin>>a[i];
    }
    sort(a,a+3);
    int t1=a[2]-a[0],t2=a[2]-a[1];
    int num=0;
    num+=t2;
    t1-=t2;
    if(t1%2==1)
        num+=2;
    num+=t1/2;
    cout<<num;
}


Measured memory_bytes: 256
from collections import defaultdict

N = int(input())
S = [input() for _ in range(N)]

kind = ["AC","WA","TLE","RE"]
d = defaultdict(int)
for i in range(N):
    d[S[i]] += 1

for i in range(len(kind)):
    print("{} x {}".format(kind[i],d[kind[i]]))




Measured memory_bytes: 83008
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def main():
    n, m = LI()
    uf = UnionFind(n)
    for _ in range(m):
        x, y, z = LI()
        x -= 1
        y -= 1
        uf.union(x, y)
    cnt = set()
    for i in range(n):
        cnt.add(uf.find(i))
    print(len(cnt))

main()



Measured memory_bytes: 15256
import sys

N = int(input())
scores = []
box = []
cnt = 0
for i in range(N):
    scores.append(int(input()))

scores.sort()
gokei = sum(scores)

if gokei % 10 == 0:
    for i in range(N):
        aaa = gokei - scores[i]
        if aaa % 10 != 0:
            box.append(aaa)

else:
    print(gokei)
    sys.exit()
    
if box != []:
    print(max(box))
else:
    print(0)

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

int main(){
  ll n;
  vector<ll> t;
  map<ll,ll> mp;
  
  cin>>n;
  for(int i=0;i<n;i++){
    ll a;
    cin>>a;
    mp[ a ]++;
  }

  for(pair<ll,ll> p:mp){
    ll k=p.second/2;
    for(int i=0;i<k;i++)
      t.push_back(p.first);
  }
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  if(t.size()<2)cout<<0<<endl;
  else cout<<t[0]*t[1]<<endl;
  return 0;
}


Measured memory_bytes: 6528
#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 <math.h> // sqrt
#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 <iomanip> // setprecision
#include <bitset> // bitset
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using pii = pair<int, int>;
using psi = pair<string, int>;

int main() {
    int x;
    cin >> x;
    cout << 1 - x << endl;
}


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

constexpr long long MOD = 998244353;

int main() {
	int N;
	string S;
	cin >> N >> S;
	vector<int> P;
	for (int i = 1; i * i <= N; i++) {
		if (N % i == 0) {
			P.push_back(i);
			if (N / i != i) P.push_back(N / i);
		}
	}
	sort(P.begin(), P.end());
	vector<long long> ANS(N + 1);
	for (int L : P) {
		int X = N / L;
		if (X % 2 == 0) continue;
		string T = S.substr(0, L);
		long long COUNT = 0;
		for (int i = 0; i < L; i++) {
			COUNT *= 2;
			COUNT += T[i] - '0';
			COUNT %= MOD;
		}
		string U = "";
		for (int i = 0; i < N; i++) {
			if (i % (L * 2) < L) U += T[i % L];
			else U += T[i % L] ^ 1;
		}
		if (U <= S) COUNT++;
		COUNT %= MOD;
		ANS[L] = COUNT;
	}
	for (int L : P) {
		for (int K : P) {
			if (L > K&& L % K == 0) {
				ANS[L] += MOD - ANS[K];
				ANS[L] %= MOD;
			}
		}
	}
	long long SUM = 0;
	for (int L : P) {
		SUM += ANS[L] * L * 2;
		SUM %= MOD;
	}
	cout << SUM << endl;
}

Measured memory_bytes: 2628