akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  ll h,n;
  cin >> h >> n;
  ll tl = 0;
  rep(i, n) {
    ll p;
    cin >> p;
    tl += p;
  }

  if (tl >= h) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
	    int A = sc.nextInt();
	    int B = sc.nextInt();
	    int C = sc.nextInt();
	    sc.close();
	    
	    boolean check=false;
	    
	    for(int i = 1; i<=B; i++) {
	    	if ((i*A)%B==C){
	    		check=true;
	    		break;
	    	}
	    }
	    
	    if (check==false)
	    	System.out.println("NO");
	    
	    else 
	    	System.out.println("YES");
	}

}


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

int main() {
  int N; cin >> N;
  vector<int> A(N);
  //  6   3   1   2   7   4   8   5
  // [1] [2] [3] [4] [5] [6] [7] [8]
  //
  //  1   2   3   4   5   6   7   8
  // [2] [3] [1] [5] [7] [0] [4] [6]
  for (int i = 0; i < N; i++) {
    int a; cin >> a; a--;
    A.at(a) = i;
  }
  int cnt = 0;
  int tmp = 1;
  for (int i = 1; i < N; i++) {
    if (A.at(i) > A.at(i-1)) tmp++;
    else {
      cnt = max(cnt, tmp);
      tmp = 1;
    }
  }
  cnt = max(cnt, tmp);
  cout << N - cnt << endl;
}

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

int main() {
  int a,b,c,k;
  cin >> a >> b >> c;
  cin >> k;
  
  for(int i=0;i<k;i++){
    if(b<=a)	b=b*2;
    else	c=c*2;
  }
  
  string s="Yes",t="No";
  
  if(a<b&&b<c)	cout << s;
  else	cout << t;
  
  return 0;
}


Measured memory_bytes: 3632
// ITP1_7_D
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int n,m,l;
    cin>>n>>m>>l;
    vector<vector<int>> a(n,vector<int>(m));
    vector<vector<int>> b(m,vector<int>(l));
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            int num;
            cin>>num;
            a[i][j]=num;
        }
    }
    for(int i=0;i<m;i++){
        for(int j=0;j<l;j++){
            int num;
            cin>>num;
            b[i][j]=num;
        }
    }
    // cout<<a<<endl;
    // cout<<b<<endl;
    for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            ll aa=0;
            for(int k=0;k<m;k++){
                aa+=a[i][k]*b[k][j];
            }
            cout<<aa;
            if(j!=l-1)cout<<" ";
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3216
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
typedef long long int ll;
using namespace std;
ll Lucas(int n){
	if(n==0){
		return 2;
	}
	if(n==1){
		return 1;
	}
	return Lucas(n-1)+Lucas(n-2);
}
int main()
{
	int n;
	cin >> n;

	vector<ll> lucas(87);
	lucas.at(0)=2;
	lucas.at(1)=1;
	for(int i=2; i<87; i++){
		lucas.at(i)=lucas.at(i-1)+lucas.at(i-2);
	}
	cout << lucas.at(n)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define lli long long int
#define ld long double
#define pb push_back
#define is insert
#define iamspid ios_base::sync_with_stdio(false); cin.tie(NULL);
int main()
{
    iamspid
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    lli n;
    cin>>n;
    lli a[n], b[n], c[n];
    for(lli i=0;i<n;i++)
    {
        cin>>a[i]>>b[i]>>c[i];
    }
    lli dp[n][3];
    dp[0][0]=a[0], dp[0][1]=b[0], dp[0][2]=c[0];
    for(lli i=1;i<n;i++)
    {
        dp[i][0]=a[i]+max(dp[i-1][1], dp[i-1][2]);
        dp[i][1]=b[i]+max(dp[i-1][0], dp[i-1][2]);
        dp[i][2]=c[i]+max(dp[i-1][0], dp[i-1][1]);
    }
    cout<<max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]))<<endl;
    return 0;
}


Measured memory_bytes: 8252
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var A = new int[N];
            var B = new int[N];
            for (int i = 0; i < N; i++)
            {
                A[i] = cin.ReadInt;
                B[i] = cin.ReadInt;
            }
            Array.Sort(B, A);

            var t = 0L;
            for (int i = 0; i < N; i++)
            {
                t += A[i];
                if (t > B[i])
                {
                    Console.WriteLine("No");
                    return; 
                }
            }
            Console.WriteLine("Yes");
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


Measured memory_bytes: 17392
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int a, b, c;
  cin >> a >> b >> c;
  if ((a && b && !c) || (!a && !b && c)) cout << "Open" << endl;
  else cout << "Close" << endl;

  return 0;
}


Measured memory_bytes: 3144
#include<iostream>
#include<cstdio>
using namespace std;
int num[1000][1000];
int main() {
	//freopen("in","r",stdin);
	int row, col; cin>>row>>col;
	for(int i=0;i<row;i++) {
		for(int j=0;j<col;j++) {
			cin>>num[i][j];
		}
	}

	for(int i=0;i<row;i++) {
		int sum = 0;
		for(int j=0;j<col;j++) {
			sum += num[i][j];
		}
		num[i][col] = sum;
	}

	for(int i=0;i<col;i++) {
		int sum = 0;
		for(int j=0;j<row;j++) {
			sum += num[j][i];
		}
		num[row][i] = sum;
	}

	int sum = 0;
	for(int i=0;i<col;i++) {
		for(int j=0;j<row;j++) {
			sum += num[j][i];
		}
	}
	num[row][col] = sum;

	for(int i=0;i<=row;i++) {
		for(int j=0;j<=col;j++) {
			printf("%d%c",num[i][j],(j==col)?'\n':' ');
		}
	}

	return 0;
}


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

#define sqr(x) ((x)*(x))

using namespace std;
const int MAXN = 233;
const double EPS = 1e-8;
const double INF = 1e16;
struct Point{
	double x, y;
};

Point g[MAXN][2], c[MAXN];
double d[MAXN][2], r[MAXN];

double operator * (const Point &u, const Point &v){
	return u.x * v.y - u.y * v.x;
}

Point operator - (Point u, const Point &v){
	u.x -= v.x;
	u.y -= v.y;
	return u;
}

double Dist(const Point &u, const Point &v){
	return sqrt(sqr(u.x - v.x) + sqr(u.y - v.y));
}

bool Pass(int l, int r, const Point &u, const Point &v){
	for (int i = l; i<=r; ++i)
		if (((v - u) * (g[i][0] - u)) * ((v - u) * (g[i][1] - u)) > -EPS) return 0;
	return 1;
}

int main(){
	while (1){
		int n;
		scanf("%d", &n);
		if (n==0) break;
		for (int i = 1; i<=n; ++i){
			int a, b, l;
			scanf("%d%d%d", &a, &b, &l);
			c[i].x = a * 1.0;
			c[i].y = b * 1.0;
			r[i] = l * 1.0;
		}
		for (int i = 1; i<n; ++i){
			double u, v, w;
			u = sqr(r[i]) - sqr(r[i + 1]) + sqr(c[i + 1].y) - sqr(c[i].y) + sqr(c[i + 1].x) - sqr(c[i].x);
			v = 2.0 * (c[i + 1].x - c[i].x);
			w = 2.0 * (c[i + 1].y - c[i].y);
//printf("%d %.7f %.7f %.7f\n", i, u, v, w);
			if (w>-EPS && w<EPS){
				double x = u / v;
				double y = sqrt(sqr(r[i]) - sqr(x - c[i].x));
				g[i][0].x = x;
				g[i][0].y = y + c[i].y;
				g[i][1].x = x;
				g[i][1].y = - y + c[i].y;
			}
			else{
				double k = (-v) / w;
				double b = u / w;
//printf("%.7f %.7f\n", k, b);
				double A, B, C;
				A = (k * k + 1.0);
				B = (2.0 * k * b - 2.0 * c[i].x - 2.0 * c[i].y * k);
				C = sqr(c[i].x) + b * b - 2.0 * c[i].y * b + sqr(c[i].y) - sqr(r[i]);
//printf("%.7f %.7f %.7f\n", A, B, C);
				double Delta = sqrt(B * B - 4.0 * A * C);
				g[i][0].x = ((-B) + Delta) / (2.0 * A);
				g[i][0].y = k * g[i][0].x + b;
				g[i][1].x = ((-B) - Delta) / (2.0 * A);
				g[i][1].y = k * g[i][1].x + b;
			}
//printf("%.7f %.7f %.7f %.7f\n", g[i][0].x, g[i][0].y, g[i][1].x, g[i][1].y);
		}

		for (int i = 1; i<n; ++i)
			for (int l = 0; l<2; ++l){
				d[i][l] = INF;
				if (Pass(1, i - 1, c[1], g[i][l])){
//printf("Pass C1 C%d %.7f %.7f\n", i, g[i][l].x, g[i][l].y);
					d[i][l] = fmin(d[i][l], Dist(c[1], g[i][l]));
				}
				for (int j = 1; j<i; ++j)
					for (int k = 0; k<2; ++k)
						if (Pass(j + 1, i - 1, g[j][k], g[i][l])){
//printf("Pass C%d C%d %.7f %.7f %.7f %.7f\n", j, i, g[j][k].x, g[j][k].y, g[i][l].x, g[i][l].y);
							d[i][l] = fmin(d[i][l], d[j][k] + Dist(g[j][k], g[i][l]));
						}
			}
		double ans = INF;
		if (Pass(1, n - 1, c[1], c[n])) ans = Dist(c[1], c[n]);
		for (int i = 1; i<n; ++i)
			for (int l = 0; l<2; ++l)
				if (Pass(i + 1, n - 1, g[i][l], c[n]))
					ans = fmin(ans, d[i][l] + Dist(g[i][l], c[n]));
		printf("%.7f\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1236
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a) = min((a), (b)))
#define chmax(a, b) ((a) = max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const double pi = acos(-1);
const double eps = 1e-10;

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

int main(){
    int n, q; cin>>n>>q;
    vector<T> X(n);
    for(int i=0; i<n; i++){
        int s, t, x; cin>>s>>t>>x;
        X[i] = T(x, max(s - x, 0), max(t - x, 0));
    }

    sort(X.begin(), X.end());

    set<P> st;
    for(int i=0; i<q; i++){
        int d; cin>>d;
        st.insert(P(d, i));
    }

    vector<int> ans(q, -1);
    for(int i=0; i<n; i++){
        int x, s, t;
        tie(x, s, t) = X[i];
        auto itr = st.lower_bound(P(s, -1));

        while(itr != st.end()){
            if(t <= itr->first) break;

            ans[itr->second] = x;
            st.erase(itr++);
        }
    }

    for(int i=0; i<q; i++){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 14336
n,m = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]

good = [1]*n

for comb in ab:
    a = comb[0]-1
    b = comb[1]-1
    if h[a] <= h[b]:
        good[a] = 0
    if h[a] >= h[b]:
        good[b] = 0

ans = sum(good)
print(ans)

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

int main(){
    int N,K;
    int A[100000]={};
    int p;
    cin >> N >> K;
    for(int i=0;i<N;i++){
        cin >> A[i];
        if(A[i] == 1){
            p = i;
        }
    }
    int ans = 1;
    ans += ceil(float(N-K) / (K-1));
    cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
string s;
bool dp[100005];
bool solve(int idx) {
    if(idx == s.size()){
        puts("YES");
        exit(0);
    }
    if(dp[idx])return 1;
    dp[idx] = 1;
    if(s.size() - idx >=5){
        if(s.substr(idx,5) == "dream" || s.substr(idx,5) == "erase" )
            solve(idx+5);
    }
    if(s.size() - idx >=7){
        if(s.substr(idx,7) == "dreamer" )
            solve(idx+7);
    }if(s.size() - idx >=6){
        if(s.substr(idx,6) == "eraser" )
            solve(idx+6);
    }

    return 1;
}
int main() {
    cin >> s;
    solve(0);
    puts("NO");
}


Measured memory_bytes: 2176
#include<iostream>
using namespace std;
int main() {
    int n, k, a;
    a = 1;
    cin >> n;
    cin >> k;
    for(int i = 0; i < n; i++) {
        if(a > k) {
            a += k;
        }else{
            a *= 2;
        }
    }
    cout << a <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

string convert(string s)
{
	ostringstream oss;
	s+="#";
	for(int i=0,j=1;i<s.size()-1;i++){
		if(s[i]==s[i+1])
			j++;
		else{
			oss<<j<<s[i];
			j=1;
		}
	}
	return oss.str();
}

int main()
{
	for(int n;cin>>n,n;){
		string s;
		cin>>s;
		rep(i,n)
			s=convert(s);
		cout<<s<<endl;
	}
	
	return 0;
}

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

Measured memory_bytes: 128
#include <stdio.h>
int main(void) {
    int a1, a2, a3;
    scanf("%d", &a1);
    scanf("%d", &a2);
    scanf("%d", &a3);
    if ((a1+a2+a3) >= 22) {
        printf("bust");
    } else {
        printf("win");
    }
    return 0;
}

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

int main() {
  int N,K;
  cin>>N>>K;
  if(K*2>(N-2)*(N-1)){
    cout<<"-1"<<endl;
  }
  else{
    cout<<N*(N-1)/2-K<<endl;
    for(int i=1;i<N;i++){
      cout<<i<<" "<<N<<endl;
    }
    int x=(N-1)*(N-2)/2-K;
    int a=1,b=1;
    for(int i=0;i<x;i++){
      b++;
      if(b>=N){
        a++;
        b=a+1;
      }
      cout<<a<<" "<<b<<endl;
    }
  }
}

Measured memory_bytes: 3600
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF=1LL << 60;
long long a,b;
long long dp[100200][110];
long long w[110],v[110];

int main() {
   int a;
   cin>>a;
   if(a<1200){
       cout<<"ABC"<<endl;
   }
   else{
       cout<<"ARC"<<endl;
   }
}


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

using namespace std;

bool isPrime(int n)
{
	if(n <= 2) return true; 
	for(int i=2; i*i <= n; i++)
		if(n%i == 0) return false;
	return true;
}

int main()
{
	int a, n, count=0;
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> a;
		if(isPrime(a)) count++;
	}
	cout << count << endl;
}




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

void print(vector<int>& a)
{
    int N=a.size();
    for(int i=0;i<N;i++) cout<<a[i]<<(i==N-1? '\n':' ');
}

int main()
{
    int N; cin>>N;
    vector<int> a(N);
    for(int i=0;i<N;i++) cin>>a[i];

    print(a);
    for(int i=1;i<N;i++){
        int j=i,val=a[i];
        while(j-1>=0 and a[j-1]>val) a[j]=a[j-1],j--;
        a[j]=val;
        print(a);
    }
    return 0;
}


Measured memory_bytes: 3104
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<int> P(N);
    rep(i, 0, N) {
        cin >> P[i];
    }
    vector<double> sum(1010, 0.0);
    rep(i, 1, 1010) {
        sum[i] = i + sum[i - 1];
    }
    vector<double> exp(N);
    rep(i, 0, N) {
        exp[i] = sum[P[i]] / P[i];
    }
    double now_exp = 0.0;
    rep(i, 0, K) {
        now_exp += exp[i];
    }
    double max_exp = now_exp;
    rep(i, K, N) {
        now_exp += exp[i] - exp[i - K];
        chmax(max_exp, now_exp);
    }
    cout << fixed << setprecision(10) << max_exp << endl;
    return 0;
}

Measured memory_bytes: 2560
L,R=map(int,input().split())
#2019=3*673
if (R-L+1>2050):
    print(0)
else:
    ans=2018
    for i in range(L,R+1):
        for j in range(L,R+1):
            if i<j:
                ans=min(ans,(i*j)%2019)
    print(ans)


Measured memory_bytes: 40940
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL (1LL<<62) // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll s;
    cin >> s;
    vi dp(2001, 0);
    dp[0] = 1;

    for(ll i=3; i<=2000; i++){
        dp[i] = dp[i-1] + dp[i-3];
        dp[i] %= MODV;
    }
    cout << dp[s] << endl;
}

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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

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);

//const ll mod = 1e10;
typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;

struct E {
    int i, place, count;

    E(int i, int place, int count) : i(i), place(place), count(count) {};
};


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

    vector<int> v(n);
    rep(i, n) cin >> v[i];
    for (int &i : v) i--;

    vector<int> tmp(n * n, -1);
    rep(i, n) tmp[v[i]] = i;


    auto st = [](E &e1, E &e2) {
        return e1.place < e2.place;
    };
    auto gt = [&](E &e1, E &e2) {
        return e1.place > e2.place;
    };

    priority_queue<E, vector<E>, decltype(gt)> l(gt);
    rep(i, n) if (i > 0) l.emplace(i, v[i], i);

    priority_queue<E, vector<E>, decltype(st)> r(st);
    rep(i, n - 1) r.emplace(i, v[i], n - 1 - i);


    rep(i, n * n) {
        if (tmp[i] != -1) continue;
        if (l.empty()) continue;

        E t = l.top();
        l.pop();
        tmp[i] = t.i;
        int count = t.count - 1;
        if (count == 0) continue;
        l.emplace(t.i, t.place, count);
    }


    for (int i = n * n - 1; i >= 0; i--) {
        if (tmp[i] != -1) continue;
        if (r.empty()) continue;

        E t = r.top();
        r.pop();
        tmp[i] = t.i;
        int count = t.count - 1;
        if (count == 0) continue;
        r.emplace(t.i, t.place, count);
    }


    vector<int> s(n, -1), ct(n * n, -1);
    rep(i, n * n) {
        s[tmp[i]]++;
        ct[i] = s[tmp[i]];
    }

    rep(i, n) {
        int j = v[i];
        if (ct[j] != i) {
            cout << "No" << endl;
            ret();
        }
    }

    cout << "Yes" << endl;
    rep(i, n * n) cout << tmp[i] + 1 << endl;

}


Measured memory_bytes: 3200
#include<iostream>
#include<string.h>
#include<queue>
#include<map>
#include<vector>
#include <cstdlib>
#include<algorithm>
#include <cstdio>
#include <cctype>
using namespace std;
const long long INF=10000000000000LL;
typedef long long ll;
typedef pair<ll,ll> P;
ll N,M,K=0;
ll T,a[15]={},b=0;
ll A,B,C[505],S[505],F[505];
ll D[1005]={};
string str;
map<string,int> m;

int main(){
	cin>>N;
	for(int i=0;i<N-1;++i){
		cin>>C[i]>>S[i]>>F[i];
	}
	for(int i=0;i<N-1;++i){
		D[i]=S[i]+C[i];
		for(int j=i+1;j<N-1;++j){
			if(D[i]<=S[j]){
				D[i]=S[j]+C[j];
			}else{
				ll v=(D[i]-S[j])/F[j];
				if((D[i]-S[j])%F[j]>0)++v;
				D[i]=S[j]+F[j]*v+C[j];
			}
		}
	}
	for(int i=0;i<N;++i){
		cout<<D[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	long long n,m,i,j,l[2010],a[2010],b[2010],c[2010],co[2010]={};
	for(i=2;i<2000;i++)co[i]=-1e18;
	scanf("%lld %lld",&n,&m);
	for(i=0;i<m;i++)scanf("%lld %lld %lld",&a[i],&b[i],&c[i]);
	for(i=0;i<n;i++){
		for(j=l[i]=0;j<m;j++){
			if(co[a[j]]+c[j]>co[b[j]])co[b[j]]=co[a[j]]+c[j];
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			if(co[a[j]]+c[j]>co[b[j]]){
				co[b[j]]=co[a[j]]+c[j];
				l[b[j]]=1;
			}
			if(l[a[j]])l[b[j]]=1;
		}
	}
	if(l[n]==0)printf("%lld\n",co[n]);
	else       printf("inf\n");
	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		ArrayList<Integer>array = new ArrayList<Integer>();
		long ans = 0;

		for(int i=1; i<=N; i++) {
			if( !(i%3==0 || i%5==0) ){
				array.add(i);
			}
		}
		for(int i=0; i<array.size(); i++) {
			ans += array.get(i);
		}

		System.out.println(ans);

		sc.close();

	}

}


Measured memory_bytes: 61552
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

a = sorted(inl())
n = a[2] - a[1] + a[2] - a[0]
print((n + 2 - 1) // 2 + 1 if n % 2 else n//2)

Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int ar[100005];
int32_t main(){
	int n;cin>>n;for(int i=1;i<=n;i++) cin>>ar[i];sort(ar+1,ar+n+1);
	int ans = ar[n/2+1]-ar[n/2];
	cout<<ans;
}


Measured memory_bytes: 1152
mod = 998244353
N = int(1e6)
n, k = map(int, input().split())
seg = []
for i in range(k):
    seg.append(tuple(map(int, input().split())))
pref = [1] + [0] * N
for i in range(1, n):
    pref[i] += pref[i - 1]
    for x, y in seg:
        pref[i] += pref[i - x] - pref[i - y - 1] + mod
    pref[i] %= mod
print((pref[n - 1] - pref[n - 2] + mod) % mod)


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

ans = 1
trend = 0
last = -1
for a in A:
    if last == -1:
        last = a
        continue
    if a > last:
        if trend < 0:
            ans += 1
            last = -1
            trend = 0
        else:
            trend = 1
    elif a < last:
        if trend > 0:
            ans += 1
            last = -1
            trend = 0
        else:
            trend = -1
    last = a

print(ans)


Measured memory_bytes: 62704
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
  int N;
  cin >>N;
 vector<int>vec(N);
  vector<int>vect(N);
  vector<int>vecto(N-1);
  rep(i,N) {
cin >>vec.at(i);
  }
  rep(i,N) {
    cin >>vect.at(i);
  }
  rep(i,N-1) {
cin >>vecto.at(i);
  }
  
  
  int count=0;
  
  rep(i,N-1) {
    count +=vect.at(vec.at(i)-1);
    if(vec.at(i)+1==vec.at(i+1)) {
      count +=vecto.at(vec.at(i)-1);
    }
       }
       
  count +=vect.at(vec.at(N-1)-1);
       cout <<count<< endl;
       }
      

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

now = 1000
stock = 0
down = []

for i in range(1, n):
    if A[i-1] > A[i]:
        down.append(i-1)

if len(down) > 0:
    if down[0] != 0:
        stock = 1000//A[0]
        now %= A[0]

    for i in range(len(down)):
        now += stock*A[down[i]]
        stock = 0
        if (i != len(down)-1 and down[i+1] == down[i]+1) or down[i] == n-2:
            pass
        else:
            a = A[down[i]+1]
            stock = now//a
            now %= a
            # print(now)
    if down[-1] == n-2:
        pass
    else:
        now += stock*A[n-1]
    # print(down)
else:
    now += (now//A[0])*(A[-1]-A[0])

print(now)


Measured memory_bytes: 9112
#include<stdio.h>
int main(){
  int a,b,c=1;
  scanf("%d %d",&a,&b);
  char s[a+b+2];
  scanf("%s",s);
  for(int i=0; i<a+b+1; i++){
    if(i<a){
      if(!('0'<=s[i]&&s[i]<='9')){
        c=0;break;
      }
    }else if(i==a){
      if(s[i]!='-'){
        c=0;break;
      }
    }else{
      if(!('0'<=s[i]&&s[i]<='9')){
        c=0;break;
      }
    }
  }
  printf(c?"Yes":"No");
  return 0;}

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


int main() {
	string s;
	cin>>s;
	if(s.size()==2){
		cout<<s<<endl;
		return 0;
	}else{
		cout<<s.substr(2,1)+s.substr(1,1)+s.substr(0,1)<<endl;
	}
		return 0;
}



Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

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

func main() {
	var N int
	fmt.Scan(&N)
	A := make([]int, N)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 0; i < N; i++ {
		sc.Scan()
		A[i], _ = strconv.Atoi(sc.Text())
	}
	ans := A[0]
	for i := 1; i < N; i++ {
		ans = gcd(ans, A[i])
	}
	fmt.Println(ans)
}


Measured memory_bytes: 3072
def collatz(n):
    if n%2 == 0:
        return n/2
    else:
        return 3*n+1

s=int(input())
nlist =[]
tmp_in = collatz(s)
nlist.append(s)
nlist.append(tmp_in)
cnt = 1
while True:
    cnt += 1
    tmp_out = collatz(tmp_in)

    if tmp_out in nlist:
        print(len(nlist)+1)
        #print(nlist)
        break
    nlist.append(tmp_out)
    tmp_in = tmp_out


Measured memory_bytes: 3060
#include <iostream>

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

int main() {
	int N, D, X, A[100]; cin >> N >> D >> X;
	rep(i, 0, N) {
		cin >> A[i];
	}
	int choco = 0;
	rep(i, 0, N) {
		rep(j, 1, D + 1) {
			if (j == 1 || (j - 1) % A[i] == 0) {
				choco++;
			}
		}
	}
	cout << choco + X << endl;
}

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

int main(void)
{
	int err;
	long n, m, q;
	err = scanf("%ld%ld", &n, &m);
	if (err != 2) exit(1);
	q = m/n;
	for (;;)
	{
		if (m%q == 0)	
		{
			if (m/q >= n)
			{
				printf("%d\n", q);
				return 0;
			}else
			{
				q--;
			}
		}else
		{
			q--;
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

#define MAX 200000

int max(int a, int b){return a>b ? a: b;}
int min(int a, int b){return a<b ? a: b;}

int main(){
    int R[MAX], i, n;
    
    scanf("%d",&n);
    for(i=0; i<n; i++) scanf("%d",&R[i]);
    
    int maxv = -2000000000;
    int minv = R[0];
    
    for(int i=1; i<n; i++){
        maxv = max(maxv,R[i] - minv);
        minv = min(minv,R[i]);
    }
    printf("%d\n",maxv);
    return 0;
}




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

void chmin(int& a, int b) {
  if (a > b) a = b;
}


int main() {
  int H, N;
  cin >> H >> N;
  
  vector<int> A(1010), B(1010);
  
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
  }
  
  vector<int> dp(20100, 100000000);
  
  dp[0] = 0;
  
  for (int i = 0; i < 10000; i++) {
    for (int j = 0; j < N; j++) {
      chmin(dp[i+ A[j]], dp[i] + B[j]);
    }
  }
  
  int ans = dp[H];
  for (int i = H; i <= 20000; i++) {
    chmin(ans, dp[i]);
  }
  
  cout << ans << endl;
  
    
  
}

Measured memory_bytes: 3648
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		ArrayList<Integer> list = new ArrayList<Integer>();

		for(int j = 0; j < n; j++) {
			list.add(Math.abs(sc.nextInt()-x));
		}

		x = list.get(0);

		for(int i = 1; i < list.size(); i++) {
			if(list.get(i) < x) {
				x = gcd(x, list.get(i));
			}else {
				x = gcd(list.get(i), x);
			}
		}
		System.out.println(x);
	}
	static int gcd(int a, int b) {
		int tmp;

		while((tmp = a%b) != 0) {
			a = b;
			b = tmp;
		}
		return b;
	}
}

Measured memory_bytes: 48680
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func exec(stdin *Stdin, stdout *Stdout) {
	n := stdin.ReadInt()
	a := stdin.ReadInt()
	b := stdin.ReadInt()

	ans := n / (a + b) * a
	mod := n % (a + b)
	if mod < a {
		ans += mod
	} else {
		ans += a
	}
	stdout.Println(ans)
}

func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), int(math.MaxInt32))
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}


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

int main(){
	long long N, M, K;
	cin >> N >> M >> K;
    vector<long long> A(N), B(M);
    vector<long long> sumA(N+1,0), sumB(M+1,0);
    for(int i=0; i<N; i++){
        cin >> A.at(i);
    }
    for(int i=0; i<N+1; i++){
        if( i==0 ){
            sumA.at(i) = 0;
        }
        else{
            sumA.at(i) = sumA.at(i-1) + A.at(i-1);
        }
    }
    for(int i=0; i<M; i++){
        cin >> B.at(i);
    }
    for(int i=0; i<M+1; i++){
        if( i==0 ){
            sumB.at(i) = 0;
        }
        else{
            sumB.at(i) = sumB.at(i-1) + B.at(i-1);
        }
    }

    int ans=0;
    int j=M;
    for(int i=0; i<N+1; i++){
        if( sumA.at(i) > K){
            break;
        }
        while( K-sumA.at(i) < sumB.at(j) ){
            j--;
        }
        ans = max(ans,i+j);
    }

	cout << ans << endl;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
using ll = long long;
using P = pair<ll, ll>;

const ll infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
    IoSetup() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void fail() {
    cout << -1 << endl;
    exit(0);
}

int main(){
    ll n;
    cin >> n;
    ll cur = -1, cnt = 0;
    vector<ll> a(n);
    for(ll i=0; i < n; i++){
        cin >> a[i];
        if(cur == a[i]){
            cur = -1;
            cnt += 1;
        }else{
            cur = a[i];
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vvint cnt(10,vint(10,0));
    for(int i=1;i<=n;++i){
        if(i%10==0) continue;
        int b=i%10;
        string s = to_string(i);
        int a = (int)(s[0]-'0');
        cnt[a][b]++;
    }
    ll ans = 0;
    for(int i=1;i<=n;++i){
        if(i%10==0) continue;
        int b=i%10;
        string s = to_string(i);
        int a = (int)(s[0]-'0');
        ans += (ll)cnt[b][a];
        //cout << ans << endl;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main(){
    const long long mod = 1000000007;
    int H,W,K;
    cin >> H >> W >> K;
    long long b[7] =  {1,2,3,5,8,13,21};
    if(W==1) cout << 1 << endl;
    if(W>=2){
        long long dp[H+1][W] = {0};
        dp[0][0] = 1;
        for(int i=1; i<W; i++){
            dp[0][i] = 0;
        }
        for(int i=1; i<H+1; i++){
            for(int j=0; j<W; j++){
                if(j-1>=0){
                    dp[i][j] += dp[i-1][j-1]*b[max(0,j-2)]*b[max(0,W-j-2)];
                    dp[i][j] %= mod;
                }
                dp[i][j] += dp[i-1][j]*b[max(0,j-1)]*b[max(0,W-j-2)];
                dp[i][j] %= mod;
                if(j+1<W){
                    dp[i][j] += dp[i-1][j+1]*b[max(0,j-1)]*b[max(0,W-j-3)];
                    dp[i][j] %= mod;
                }
            }
        }
        cout << dp[H][K-1] << endl;
    }
    return 0;
}



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


using namespace std;

int main()
{
    string a;
    char buf;
    while(scanf("%c",&buf)){
        if(buf == '\n'){
            break;
        }

        if(!isalpha(buf)){
            a.push_back(buf);
        }else if(isupper(buf)){
            a.push_back(tolower(buf));
        }else if(islower(buf)){
            a.push_back(toupper(buf));
        }

    }

    cout << a << endl;

}

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

int main() {
  int n; cin>>n;
  string s;
  cin>>s;
  int i=1,k=0,c=1;
  while(i<n){
    if(s.at(i)!=s.at(k)){c++;k=i;}
    i++;
  }
  cout<<c;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int a = scan.nextInt();
	int b = scan.nextInt();

	if(a*b % 2 == 0){
	    System.out.println("No");
	}else{
	    System.out.println("Yes");
	}
    }
}
	


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

int main(){
  long long H,ans,k=0;
  cin>>H;
  while(H!=0){
    H=H/2;
    k++;
  }
  for(int i=0;i<k;i++){
    ans+=pow(2,i);
  }
  cout<<ans;
}

Measured memory_bytes: 512
import Control.Monad
import Data.Char
import Data.List
import qualified Data.Vector.Mutable as MV
import Text.Printf

solve c = trans codePoint
  where
    codePoint = fromEnum c
    trans codePoint
      | 97 <= codePoint && codePoint <= 122 = toEnum (codePoint - 32) :: Char
      | 65 <= codePoint && codePoint <= 90 = toEnum (codePoint + 32) :: Char
      | otherwise = c

main1 = do
  string <- getLine
  putStrLn $ map solve string

solve2 :: String -> Int
solve2 numbers = sum $ map (\n -> (fromEnum n) - (fromEnum '0')) numbers
  -- foldr (\n m -> m + ((fromEnum n) - 48)) 0 numbers

main2 = do
  strings <- fmap (takeWhile (/= "0") . lines) getContents
  let ints = map solve2 $ strings
  mapM_ (putStrLn . show) $ ints

main = do
  strings <- getContents
  vector <- MV.replicate 26 0
  solve3' strings vector
  forM_ (zip [0..25] ['a'..'z']) $ \ia -> do
    let (i,a) = ia
    count <- MV.read vector i
    putStrLn $ [a] ++ " : " ++ (show count)

solve3 list = map (\(n:ns) -> (n,length (n:ns))) list'
  where
    list' = group . sort . filter isAlpha . map toLower $ list

solve3' list vector = do
  forM_ list $ \n -> do
    when (isAlpha n) $ do
      let c = fromEnum n
      if 97 <= c
        then do
        MV.read vector (c-97) >>= (\v -> MV.write vector (c-97) (v+1))
        else do
        MV.read vector (c-65) >>= (\v -> MV.write vector (c-65) (v+1))



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

void Funca() {
	int a, b, x;
	std::cin >> a >> b >> x;
	if (a <= x && a + b >= x) {
		std::cout << "YES" << std::endl;
	}
	else
	{
		std::cout << "NO" << std::endl;

	}
}

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



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

#include <iostream>
#include <fstream>

#include <iostream>
#include "bits/stdc++.h"

using namespace std;

typedef unsigned long long ll;
typedef int                     integer;
#define int                     long long
#define ii                      pair<int,int>
#define vii                     vector<pair<int,int>>
#define vi                      vector<int>
#define vvi                     vector<vector<int>>
#define f(a,b,c)                for(int a=b;a<c;a++)
#define s(x)                    in>>x
#define s2(x,y)                 in>>x>>y
#define s3(x,y,z)               in>>x>>y>>z
#define s4(x,y,z,w)             in>>x>>y>>z>>w
#define p(x)                    out<<x<<endl
#define p2(x,y)                 out<<x<<" "<<y<<endl
#define pl(x)                   out<<x
#define p2l(x,y)                out<<x<<" "<<y
#define p1d(a,n)                for(int ix=0;ix<n;ix++) out<<a[ix]<<" "; out<<endl
#define p2d(a,n,m)              for(int ix=0;ix<n;ix++){ for(int jx=0;jx<m;jx++) out<<a[ix][jx]<<" "; out<<endl;}
#define range(v)                v.begin(),v.end()
#define w(x)                    while(x--)
#define rst(x)                  memset(x, -1, sizeof(x))
#define UNVISITED               -1
#define VISITED                 0
#define EXPLORED                2
map<char,int> letters;
char final[10];
void rec_print(int n, vector<char> &poss, std::ostream& out){
    if(n == 0) {f(i,0,poss.size()) out<<final[i]; out<<endl;
        return;}
    if(letters.empty()){
        final[poss.size() -n] = 'a';
        letters['a'] += 1;
        rec_print(n-1, poss, out);
        letters['a']-=1;
        if(letters['a'] == 0){
            letters.erase('a');
        }
    }
    else{
        for(auto pp:letters){
            final[poss.size() -n] = pp.first;
            letters[pp.first] += 1;
            rec_print(n-1, poss, out);
            letters[pp.first]-=1;
            if(letters[pp.first] == 0){
                letters.erase(pp.first);
            }
        }
        if(letters.size() < poss.size()){
            char nxtt = 'a' + letters.size();
            final[poss.size() -n] = nxtt;
            letters[nxtt] += 1;
            rec_print(n-1, poss, out);
            letters[nxtt]-=1;
            if(letters[nxtt] == 0){
                letters.erase(nxtt);
            }
        }
    }
}
void ssolve(std::istream& in, std::ostream& out){
        int n;
        s(n);
        vector<char> poss(n);
        f(i,0,n)poss[i] = 'a'+i;
        letters.clear();
        rec_print(n,poss,out);
}

class DStringEquivalence {
public:
	void solve(std::istream& in, std::ostream& out) {
        ios_base::sync_with_stdio(false);
        in.tie(0);out.tie(0);
        int t;
        int READ = 0;
        if(READ) s(t);
        else t = 1;
        while(t--){
            ssolve(in, out);
        }
	}
};


integer main() {
	DStringEquivalence solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
}


Measured memory_bytes: 1536
n, m, c = gets.chomp.split.map(&:to_i)
b = gets.chomp.split.map(&:to_i)
ans = 0
sum = 0
n.times do |i|
    a =  gets.chomp.split.map(&:to_i)
    sum = 0
    m.times do |j|
        sum += a[j] * b[j]
    end
    sum += c
    if sum > 0
        ans += 1
    end
end
puts ans

Measured memory_bytes: 1788
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func readLine() string {
	sc.Scan()
	return sc.Text()

}

func main() {
	str := strings.Split(readLine(), "")

	b := true
	for i, v := range str {

		if (i+1)%2 == 0 {
			if v == "R" {
				b = false
			}
		} else {
			if v == "L" {
				b = false
			}
		}

	}

	if b {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;ll m;
	ll ans=0LL;
	ll sum=0LL;
	cin >>n>>m;
	V a(n);
	map<ll,ll>dis;
	rep(i,n){
		cin>>a[i];
		a[i]%=m;
		sum+=a[i];
		sum%=m;
		dis[sum]++;
	}
	dis[0]++;
	repi(itr,dis){
		
			ans+=itr->S*(itr->S-1)/2LL;
	
	}
	cout<<ans<<endl;
}

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

using namespace std;

int main()
{
	string s, p;
	cin >> s;
	cin >> p;

	s += s;
	string::size_type idx = s.find(p);

	idx != string::npos ? cout << "Yes" << endl : cout << "No" << endl;

	return 0;
}

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

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>

int main() {
    int N;
    cin>>N;
    vi A(N-1), Ans(N);
    REP(i, 0, N-1){
        int a;
        cin >> a;
        a--;
        Ans[a]++;
    }
    REP(i, 0, N){
        cout << Ans[i] << endl;
    }


}

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

using namespace std;

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

int main(){
    int k;
    long long int ans = 0;
    cin >> k;

    for(int a = 1;a <= k;a++){
        for(int b = 1;b <= k;b++){
            for(int c = 1;c <= k;c++){
                int tmp;
                tmp = gcd(max(a,b),min(a,b));
                ans += gcd(max(c,tmp),min(c,tmp));
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3644
import collections

n = int(input())
a = list(map(int, input().split()))
counter = collections.Counter(a)
diffs = {k: v - 1 for k, v in counter.items()}
s = sum(v * (v - 1) // 2 for v in counter.values())
for v in a:
    print(s - diffs[v])

Measured memory_bytes: 31900
#include <iostream>
using namespace std;
//0右向き 1上無機 //曲がれるか否か
int main() {
	// your code goes here
	while(true){
	int w,h;
	cin >> w >> h;
	if(w==0)
	break;
	int DP[101][101][2][2]={};
	DP[1][2][1][0]=1;
	DP[2][1][0][0]=1;
	
	for(int i=1;i<=w;i++){
		for(int j=1;j<=h;j++){
			if(!((i<=2&&j<=2)&&(i+j!=4))){
			DP[i][j][0][0]=(DP[i-1][j][0][0]+DP[i-1][j][0][1])%100000;
			DP[i][j][0][1]=DP[i-1][j][1][0]%100000;
			DP[i][j][1][0]=(DP[i][j-1][1][0]+DP[i][j-1][1][1])%100000;
			DP[i][j][1][1]=DP[i][j-1][0][0]%100000;
			}
		//	cout << DP[w][h][0][0] << " " <<  DP[w][h][0][1] << " " << DP[w][h][1][0]<< " " <<DP[w][h][1][1] << " " << i << " " << j << endl;
		}
	}
	cout << (DP[w][h][0][0]+DP[w][h][0][1]+DP[w][h][1][0]+DP[w][h][1][1])%100000 << endl;
	}
	return 0;
}

Measured memory_bytes: 1328
m = 1000000000+7


def findProductSum(A, n):

    array_sum = 0
    for i in range(0, n, 1):
        array_sum = (array_sum + A[i]) % m

    array_sum_square = (array_sum * array_sum) % m

    individual_square_sum = 0
    for i in range(0, n, 1):
        individual_square_sum = (individual_square_sum + (A[i] * A[i]) % m)%m

    aaa=(array_sum_square-individual_square_sum+m)%m
    inv=pow(2,m-2,m)
    anss=aaa*inv

    return anss


n = int(input())
A = list(map(int, input().split()))

print(int(int(findProductSum(A, n)) % m))


Measured memory_bytes: 31616