akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <unordered_map>
#include <iterator>
#include <stack>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <cstring>
#include <bitset>

#include <random>
#define all(x) (x).begin(), (x).end()


using namespace std;
void dout() { cerr << endl; }
typedef long long ll;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

using ll = long long;
using pii = pair<ll, ll>;
using ld = long double;
using pll = pair<long long, long long>;

void precalc() {}
template <typename T>
void do_uniq(vector<T> vec){
    sort(all(vec));
    vec.resize(unique(all(vec)) - vec.begin());
}

#define solvsh
//#define multi
#ifdef solvsh


const int MAXN = 1e5 + 29;

void solve() {
    ll a, b;
    cin >> a >> b;
    
    if (min(a ,b) == 1)
    {
        cout << 1;
        return;
    }

    ll answr = a * b / 2;
    if (a * b % 2)
        ++answr;
    cout << answr;

}

#else
const int MAXN = 2 *  50005;

const int h = 7;

int dp[h][h][h][h];

void solve() {



}
#endif

void multisolve() {
    int t;
    cin >> t;

    while (t--)
        solve();
}

void gen(){
    cout << "100000 99999\n";

    for (int i = 0; i < 99999; ++i) {
        cout << 1 << " " << 2 + i << "\n";
    }
}

#define int int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);



#ifdef multi
    multisolve();
#else
    precalc();
    solve();
//    gen();
#endif

#ifdef LOCAL
    //cout << '\n' << (double)clock() / CLOCKS_PER_SEC << '\n';
#endif
}

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

#define fi first
#define se second
#define sz(v) (int)((v).size())
#define pb push_back

typedef long long ll;

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

	string s; cin >> s;
	for (int i=0; i<sz(s); i++) s[i]='x';
	cout << s << "\n";
}


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

using namespace std;

#include <vector>
#include <list>
#include <cstring>
#include <cmath>
#define scan(x) scanf("%d", &x)
#define scanl(x) scanf("%lld", &x)

void printarray(int* arr, int n){
	for(int i=0;i<n;i++){
		printf("%d ", arr[i]);
	}
	printf("\n");
}

void printvector(vector <int> A){
	for(auto i=A.begin();i!=A.end();i++){
		cout<<*i<<" ";
	}
	cout<<endl;
}

int main(){

	#ifndef ONLINE_JUDGE
    freopen("D:/Programming/input.txt", "r", stdin);
    freopen("D:/Programming/output.txt", "w", stdout);
	#endif

    string str;
    cin>>str;
    if (str=="ABC")cout<<"ARC";
    else cout<<"ABC";
	return 0;
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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 ll INF = 1e9+10;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll l,r,d; cin>>l>>r>>d;
  ll a=(l-1)/d, b=(r)/d;
  cout<<b-a<<endl;
}

Measured memory_bytes: 3620
import java.util.Scanner;
//import java.io.*;
//import java.util.Arrays;
public class Main {
	public static void main(String[] args) throws java.io.IOException {
		Scanner scan = new Scanner(System.in);
		//InputStreamReader is = new InputStreamReader(System.in);
		//BufferedReader br = new BufferedReader(is);
		int a = scan.nextInt();
		int b = scan.nextInt();
		while(a != 0 || b != 0){
			int count = 0;
			for(int i = a ; i <= b ;i++){
				if(i % 100 == 0){
					if(i % 400 == 0){
						System.out.println(i);
						++count;
					}
				}else if(i % 4 == 0){
					System.out.println(i);
					++count;
				}
			}
			if(count == 0){
				System.out.println("NA");
			}
			a = scan.nextInt();
			b = scan.nextInt();
			if(a != 0 || b != 0){
				System.out.println();
			}
		}
	}
}

Measured memory_bytes: 27332
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = Integer.valueOf(scan.next());
        int b = Integer.valueOf(scan.next());
        int c = Integer.valueOf(scan.next());
        scan.close();

        int[] can = {a,b,c};

        Arrays.sort(can);
        
        if(can[2] == (can[0] + can[1])) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
//
//        if(can[1]-can[0]<can[2]) {
//            int sa = can[1]-can[0];
//            int res = can[2]-sa;
//            if(res%2 == 0) {
//                System.out.println("Yes");
//            } else {
//                System.out.println("No");
//            }
//        } else {
//            System.out.println("Nono");
//        }

    }

}


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

using namespace std;

struct mint {
    static const long MOD = 1000000007;
    long value;

    constexpr mint(long value = 0) noexcept : value((value % MOD + MOD) % MOD) {}
    constexpr mint operator-() const noexcept {
        return mint(-value);
    }
    constexpr mint& operator+=(const mint& rhs) noexcept {
        if ((value += rhs.value) >= MOD) value -= MOD;
        return *this;
    }
    constexpr mint& operator-=(const mint& rhs) noexcept {
        if ((value += MOD - rhs.value) >= MOD) value -= MOD;
        return *this;
    }
    constexpr mint& operator*=(const mint& rhs) noexcept {
        (value *= rhs.value) %= MOD;
        return *this;
    }
    constexpr mint operator+(const mint& rhs) const noexcept {
        mint res(*this);
        return res += rhs;
    }
    constexpr mint operator-(const mint& rhs) const noexcept {
        mint res(*this);
        return res -= rhs;
    }
    constexpr mint operator*(const mint& rhs) const noexcept {
        mint res(*this);
        return res *= rhs;
    }
    constexpr mint pow(long e) const noexcept {
        if (e == 0) return 1;
        mint a = pow(e >> 1);
        a *= a;
        if (e % 2 == 1) a *= *this;
        return a;
    }
    constexpr mint inv() const noexcept {
        return pow(MOD - 2);
    }
    constexpr mint& operator/=(const mint& rhs) noexcept {
        return *this *= rhs.inv();
    }
    constexpr mint operator/(const mint& rhs) const noexcept {
        mint res(*this);
        return res /= rhs;
    }
    friend ostream& operator<<(ostream& os, const mint& n) noexcept {
        os << n.value;
        return os;
    }
};

mint nCk(int n, int k) {
    mint nCk = 1;
    for (int i = n; i > n - k; i--) nCk *= i;
    for (int i = 1; i <= k; i++) nCk /= i;
    return nCk;
}

int main(void) {
    int n, a, b;
    cin >> n >> a >> b;

    cout << mint(2).pow(n) - 1 - nCk(n, a) - nCk(n, b) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long 
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) a.begin(),a.end()
#define ld long double
#define ub upper_bound
#define lb lower_bound
#define pii pair<int,int>
using namespace std;
signed main(){
    fast;
    string s;
    cin>>s;
    s = '#'+s;
    if(s[3] == s[4] && s[5] == s[6]){
        cout<<"Yes";
    }
    else cout<<"No";
    return 0;
}

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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

ll N,T;
double INF=20000.0 * 10.0;

signed main() {
    cin>>N;
    vector<ll> t(N),v(N);
    rep(i,0,N){ cin>>t[i]; T+=t[i]; }
    rep(i,0,N){ cin>>v[i]; }
    vector<double> maxv(2*T+1, INF);// maxv[t]: 時刻t/2における速度

    maxv[0] = 0.0;
    rep(p,0,maxv.size()) maxv[p] = min(maxv[p], 0.0 + 0.5 * p);

    rep(p, 2*T, maxv.size()) maxv[p] = 0.0;
    rep(p,0,2*T) maxv[p] = min(maxv[p], 0.0 + 0.5 * (2*T-p));

    ll l = 0;
    rep(i,0,N){
        ll r = l + t[i]*2;
        rep(p, 0, l){
            maxv[p] = min(maxv[p], (double)v[i] + 0.5 * (l-p));
        }
        rep(p, l, r) {
            maxv[p] = min(maxv[p], (double)v[i]);
        }
        rep(p, r, maxv.size()){
            maxv[p] = min(maxv[p], (double)v[i] + 0.5 * (p-r));
        }
        l = r;
    }

    // rep(p, 0, maxv.size()){
    //     printf("%.1f - %.1f\n", p*0.5, maxv[p]);
    // }

    double ans = 0.0;
    rep(p, 1, maxv.size()){
        ans += maxv[p] + maxv[p-1];
    }
    ans /= 4;
    printf("%.5f\n",ans);

    return 0;
}


Measured memory_bytes: 512
import java.util.*;
   
public class Main {
  private static Scanner sc = new Scanner(System.in);
  public static void main(String...args) {
    while(sc.hasNext()) {
      final int n = sc.nextInt();
      if (n == 0)
        break;
      solve(n);
    }
  }
  private static int case_num = 1;
  private static void solve(final int n) {
    final int[] x = new int[n];
    final int[] y = new int[n];
    for(int i = 0; i < n; i++) {
      x[i] = sc.nextInt() - x[0];
      y[i] = sc.nextInt() - y[0];
    }
    int ans = 0;
    for(int i = 2; i < n; i++)
      ans += x[i-1] * y[i] - x[i] * y[i-1];
    System.out.println(case_num++ + " " + (.5 * Math.abs(ans)));
  }
}

Measured memory_bytes: 12000
from operator import mul

N, M, C = map(int, input().split())
Blist = list(map(int, input().split()))
Alist = [list(map(int, input().split())) for _ in range(N)]

ans = 0
for a in Alist:
    if sum(map(lambda x: mul(*x), zip(a, Blist))) + C > 0:
        ans += 1

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >>S;
  if(S.at(2)==S.at(3)&&S.at(4)==S.at(5)){
    cout<<"Yes"<<endl;}
   else{
     cout<<"No"<<endl;}
    return 0;
  }

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<math.h>
#include<vector>

long long gcd(long long x, long long y){
	if(x<y){
		long long tmp= x;
		x=y;
		y=tmp;
	}

	if(x%y==0)
		return y;
	else
		return gcd(y, x%y);
}

int main(){
	long long n, m;
	std::cin>>n>>m;

	long long gcdNM= gcd(n, m);
	long long sqGcd= sqrtl(gcdNM);

	std::vector<bool> isPrime(sqGcd+1, true);
	isPrime[0]= false;
	isPrime[1]= false;

	for(int i=2; i<isPrime.size(); i++){
		if(!isPrime[i])
			continue;

		for(int j=2*i; j<isPrime.size(); j+=i)
			isPrime[j]= false;
	}

	std::vector<long long> primeList;
	for(int i=0; i<isPrime.size(); i++)
		if(isPrime[i])
			primeList.push_back((long long)i);

	std::vector<bool> includePrime(primeList.size(), false);

	for(int i=0; i<primeList.size();){
		if(gcdNM% primeList[i] != 0){
			i++;
			continue;
		}

		includePrime[i]= true;
		gcdNM= gcdNM/primeList[i];
	}

	long long ans=1;

	for(int i=0; i<primeList.size(); i++)
		if(includePrime[i])
			ans++;

	if (gcdNM > sqGcd)
		ans++;

	std::cout<<ans<<std::endl;

	return 0;
}

Measured memory_bytes: 1528
#include<bits/stdc++.h>
#define lli long long int
#define rep(i,a,b)	for(i=a;i<b;i++)
using namespace std;
int main()
{
	lli t,i,n,ans,k,a;
	string s;
	cin >> k;
	cin >> s;
	n=s.length();
	if(n>k){
		for(i=0;i<k;i++)	cout<<s[i];
		cout<<"...";
	}
	else{
		cout<<s;
	}
	return 0;
}

Measured memory_bytes: 3592
import sys, os

f = lambda:list(map(int,input().split()))
def init():
    if 'local' in os.environ :
        sys.stdin = open('./input.txt', 'r')

def solve():
    a = input()
    if a in ['a', 'e', 'i', 'o', 'u']:
        print("vowel")
    else:
        print("consonant")

init()
solve()


Measured memory_bytes: 3060
package main

import (
  "fmt"
  "math"
)

func main() {
	var a, b, x, h float64
	fmt.Scan(&a, &b, &x)
	if a*a*b >= 2*x {
		h = x / (b * a / 2)
		fmt.Println(math.Atan(b/h) / math.Pi * 180)
	} else {
		b = 2 * (b - x/(a*a))
		fmt.Println(math.Atan(b/a) / math.Pi * 180)
	}
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <climits>
#include <cstring>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

using namespace std;

const int N_MAX = 1000000;

bool is_safe(char f[][8], int r, int c){
  rep(col, 0, 8){
    if(f[r][col] == 'x') return false;
  }
  rep(row, 0, 8){
    if(f[row][c] == 'x') return false;
  }


  for(int i = -8, j = -8;
      r+i < 8 & c+j < 8;
      i++, j++){
    if(!((0<=r+i) && (r+i<8) && (0<=c+j) && (c+j<8))) continue;
    if(f[r+i][c+j] == 'x') return false;
  }

  for(int i = -8, j = 8;
      r+i < 8 & 0 <= c+j;
      i++, j--){
    if(!((0<=r+i) && (r+i<8) && (0<=c+j) && (c+j<8))) continue;
    if(f[r+i][c+j] == 'x') return false;
  }


  for(int i = 8, j = 8;
      r+i >= 0 && c+j >= 0;
      i--, j--){
    if(!((0<=r+i) && (r+i<8) && (0<=c+j) && (c+j<8))) continue;
    if(f[r+i][c+j] == 'x') return false;
    }

  for(int i = 8, j = -8;
      r+i >= 0 && c+j < 8;
      i--, j++){
    if(!((0<=r+i) && (r+i<8) && (0<=c+j) && (c+j<8))) continue;
    if(f[r+i][c+j] == 'x') return false;
    }

  
  return true;
}

/*char** fill(char** f, int r, int c){
  f[r][c] = 'x';
  return f;
  }*/

bool solve(char f[][8], int col){
  // return true or false
  // base case
  if(col >= 8) return true;
  
  rep(row, 0, 8){
    // already filled
    if(f[row][col] == 'x'){
      if(solve(f, col+1)) return true;
    }
    
    if(is_safe(f, row, col)){
      f[row][col] = 'x';
      if(solve(f, col+1)) return true;
      f[row][col] = 'o';
    }
  }
  return false;
  // put queen
  //   if collision, not put
  //   else
  //      if further fails, not put
  // cannot put queen
  //   return false
  //   back, put away last queen
}

int main(){
  char f[8][8];
  rep(i, 0, 8){
    rep(j, 0, 8){
      f[i][j] = 'o';
    }
  }
  int k;
  cin >> k;
  rep(i, 0, k){
    int r, c;
    cin >> r >> c;
    f[r][c] = 'x';
  }

  solve(f, 0);
  
  rep(r, 0, 8){
    rep(c, 0, 8){
      if(f[r][c]=='x') cout << "Q";
      else cout << ".";
    }
    cout << endl;
  }
  return 0;
}



Measured memory_bytes: 3140
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

int main() {
    int N;
    cin >> N;
    const char clist[] = {'M', 'A', 'R', 'C', 'H'};
    lli cnt[128] = {};
    REP (i, 0, N) {
        string s;
        cin >> s;
        cnt[s[0]]++;
    }
    lli ans = 0;
    REP (i, 0, 5) REP (j, i + 1, 5) REP (k, j + 1, 5) {
        ans += cnt[clist[i]] * cnt[clist[j]] * cnt[clist[k]];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
// #define CPP_IO

#pragma region

#include <bits/stdc++.h>
using namespace std;
using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
template <typename T>
using minheap = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
using maxheap = priority_queue<T>;

#define f first
#define s second

#ifdef LOCAL
#define debug cout
#define debugf(format, ...) printf(format, ##__VA_ARGS__)
#else
#define debug \
    if (0) cout
#define debugf(format, ...) 42
#endif

#define DUMP(a) debug << #a " = " << (a) << "\n";
#define DUMP2(a, b) debug << #a " = " << (a) << " " #b " = " << (b) << "\n";
#define DUMP3(a, b, c) debug << #a " = " << (a) << " " #b " = " << (b) << " " #c " = " << (c) << "\n";
#define DUMP4(a, b, c, d) debug << #a " = " << (a) << " " #b " = " << (b) << " " #c " = " << (c) << " " #d " = " << (d) << "\n";

template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    os << "[ ";
    for (auto e : v) os << e << " ";
    return os << "]";
}

template <typename T, typename V>
ostream& operator<<(ostream& os, set<T, V> v) {
    os << "{ ";
    for (auto e : v) os << e << " ";
    return os << "}";
}

template <typename T, typename V, typename S>
ostream& operator<<(ostream& os, map<T, V, S> v) {
    os << "{ ";
    for (auto e : v) os << e << " ";
    return os << "}";
}

template <typename T, typename V>
ostream& operator<<(ostream& os, pair<T, V> x) {
    return os << "( " << x.first << ", " << x.second << " )";
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    for (auto& e : v) is >> e;
    return is;
}

template <typename T, typename V>
istream& operator>>(istream& is, pair<T, V>& x) {
    return is >> x.first >> x.second;
}

void solve();

int main() {
#ifdef LOCAL
    freopen("data.txt", "r", stdin);
#else
#ifdef CPP_IO
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
#endif
    solve();
}

#pragma endregion

string s;
int dp1[200005], dp2[200005];
void solve() {
    cin >> s;
    int n = (int)s.size();
    for (int i = 0; i < n; ++i) {
        if (i == 0) {
            dp1[i] = 1;
            dp2[i] = 0;
        } else if (i == 1) {
            dp2[i] = 1;
            if (s[i] == s[i - 1]) {
                dp1[i] = 0;
            } else {
                dp1[i] = 2;
            }
        } else {
            dp1[i] = dp2[i - 1] + 1;
            if (s[i - 1] != s[i]) {
                dp1[i] = max(dp1[i - 1] + 1, dp1[i]);
            }
            dp2[i] = dp1[i - 2] + 1;
            if (i - 3 >= 0 && (s[i - 3] != s[i - 1] || s[i - 2] != s[i])) {
                dp2[i] = max(dp2[i], 1 + dp2[i - 2]);
            }
        }
    }
    cout << max(dp1[n - 1], dp2[n - 1]) << "\n";
}

Measured memory_bytes: 2180
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define all(v) v.begin(),v.end()
#define mem(v,x) memset(v,x,sizeof(v))
#define N 100005

using namespace std;

vector<int> v[N];
ll mod = 1e9+7;
ll dp[N][2]; // 0 - white, 1 - black
void dfs(int node, int parent = 0){
    ll w = 1, b = 1;
    for(int i=0;i<v[node].size();i++){
        if(v[node][i] == parent) continue;
        dfs(v[node][i], node);
        w = (w*(dp[v[node][i]][0] + dp[v[node][i]][1]))%mod;
        b = (b*dp[v[node][i]][0])%mod;
    }
    dp[node][0] = w;
    dp[node][1] = b;
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	int n;
	cin>>n;
	for(int i=0;i<n-1;i++){
        int a,b;
        cin>>a>>b;
        v[a].pb(b);
        v[b].pb(a);
	}
	dfs(1);
	ll ans = (dp[1][0] + dp[1][1])%mod;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 14208
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define fastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define pb push_back
#define ff first
#define ss second
#define all(v) (v).begin(), (v).end()
#define mod (int)(998244353)
#define PI 3.14159265358979323846264338327950L
#define debug(vec) cout<<(#vec)<<": "; for (auto& i: vec) cout<<i<<" "; cout<<endl
#define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout << endl; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << "[ " << *it << " = " << a << " ] ";
    err(++it, args...);
}

signed main(){

    fastIO

    int t = 1;
    // cin >> t;
    while (t--){
    	char c;
    	cin >> c;
    	if ('a' <= c && c <= 'z') {
    		cout << "a";
    	}else {
    		cout << "A";
    	}
    }
    
    return 0;
}

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

using namespace std;
using ll = long long;

int main()
{
    int a, ans;
    cin >> a;
    int t = a;
    ans = a;
    for (int i = 0; i < 2; i++)
    {
        a *= t;
        ans += a;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
from collections import Counter
n = int(input())
v = list(map(int, input().split()))

a = v[0::2]
b = v[1::2]

aa = Counter(a)
bb = Counter(b)

aaa = aa.most_common()
bbb = bb.most_common()

ans = 0

if aaa[0][0] != bbb[0][0]:
  ans = n - aaa[0][1] - bbb[0][1]

else:
  if len(aa) == len(bb) == 1:
    ans = min(aaa[0][1], bbb[0][1])
  else:
    aaa.append(('-', 0))
    bbb.append(('-', 0))
    ans = n - max(aaa[0][1]+bbb[1][1], aaa[1][1]+bbb[0][1])

print(ans)


Measured memory_bytes: 27760
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main() {
  int n;
  string s;
  cin >> s;
  
  int len = s.length();
  bool ans = false;
  if(len >= 4){

    if(s.substr(0,4) == "YAKI"){
      ans = true;
    }

  }

  if(ans){
    cout << "Yes"  << endl;
  }else{
    cout << "No"  << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

int main(void)
{
	int N, K;
	cin >> N >> K;

	long long ret = 0;
	if(K == 0)
		ret = 1LL * N * N;
	else {
		for(int i=K+1; i<=N; i++){
			ret += N/i * (i-K);
			if(N%i >= K)
				ret += N%i - K + 1;
		}
	}

	cout << ret << endl;

	return 0;
}


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

using namespace std;

#define N 300000

int n,m,p,cnt,tmp,fa[N],a[N],b[N],c[N];
bool vis[N];

int gfa(int x){return fa[x]==x?x:fa[x]=gfa(fa[x]);}

void ins(int x){
	if (!vis[x=gfa(x)]){vis[x]=1; ++tmp;}
}

int main(){
	scanf("%d%d%d",&n,&m,&p);
	cnt=n;
	for (int i=0;i<n;++i) fa[i]=i;
	for (int i=1;i<=p;++i){
		scanf("%d%d%d",a+i,b+i,c+i);
		if (c[i]==0){
			if (gfa(a[i])!=gfa(b[i])){
				--cnt;
				fa[gfa(a[i])]=gfa(b[i]);
			}
		}
	}
	for (int i=1;i<=p;++i)
		if (c[i]==1){
			if (gfa(a[i])==gfa(b[i])){puts("No"); return 0;}
			ins(a[i]); ins(b[i]);
		}
	m=m-n+cnt;
	if (m>(long long)cnt*(cnt-1)/2){
		puts("No"); return 0;
	}
	if (tmp) m-=max(3,tmp);
	puts(m>=0?"Yes":"No");
	
	return 0;
}
			

Measured memory_bytes: 3328
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    System.out.println(Math.max(Math.max(A+B,A-B),Math.max(A-B,A*B)));
  }
}

Measured memory_bytes: 22868
while True:
    N = int(input())
    if N == 0:
        break
    else:
        points = [float(x) for x in input().split()]
        ave = sum(points)/N
        
        devi = [(x-ave) ** 2 for x in points]
        vari = sum(devi)/N
        a = vari ** (1/2)
        
        print(a)



Measured memory_bytes: 5712
#include "bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

using namespace std;

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

	rep(i, N) {
		order[A[i]] = i + 1;
	}
	rep(i, N) {
		cout << order[i + 1];
		if (i < N - 1)cout << " ";
	}

}



Measured memory_bytes: 5888
import itertools

n=int(input())
l=[]
for i in range(n):
    x=[int(j) for j in input().rstrip().split()]
    l.append(x)


cnt=0
ans=0
num=[i for i in range(n)]
for i in itertools.permutations(num,n):
    cnt+=1
    for j in range(n-1):
        ans+=((l[i[j]][0]-l[i[j+1]][0])**2+(l[i[j]][1]-l[i[j+1]][1])**2)**0.5
print(ans/cnt)


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

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


int main(){
    int n,count,std=1;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a.at(i);

    rep(i,n){
        if(a.at(i)==std){
            std++;
        }else{
            count++;
        }
    }
    if(count==n) cout << -1 << endl;
    else cout << count << endl;

}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
using namespace std;
int main(){
    int i,n,x,b=0,c=0,d=0;
    cin >>n;
    int a[n];
    for(i=0;i<n;i++){
        cin >> x;
        a[i] = x;
    }
    for(i=0;i<n;i++){
        c++;
        if(a[b]!=2){
            b = a[b]-1;
            d = -1;
            continue;
        }
        else if(a[b]==2){
            cout<<c;
            d = 0;
            break;
        }
    }

    if(d==-1){
        cout<<d;
    }

}


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

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
template <typename T, typename K> struct P {
	T a; K b;
};
int main( void ){
	// initialize();
	ll K, N;
	cin >> K >> N;
	vector <ll> vec( N );
	rep( i, 0, N ){
		cin >> vec[ i ];
	}
	ll maximum = vec[ 0 ] - vec[ N - 1 ] + K;
	rep( i, 1, N )
	maximum = max( maximum, vec[ i ] - vec[ i - 1 ] );
	cout << K - maximum << endl;
}

template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}
void initialize( void ){
	cout << fixed << setprecision( 10 );
}


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

int main()
{
  int A,B;scanf("%d %d",&A,&B);
  double Ai=A*12.5,Aj=(A+1)*12.5,Bi=B*10,Bj=(B+1)*10;
  double I=max(Ai,Bi),J=min(Aj,Bj);
  int k;
  if((int)I-I==0)k=I;
  else k=(int)I+1;
  if(k<J)printf("%d",k);
  else printf("-1");
}

Measured memory_bytes: 3840
N=int(input())
S=input()
S='E'+S+'W'

Es=[0]*(N+2)
Ws=[0]*(N+2)

for i in range(1, N+1):
  if S[i-1]=='E':
    Es[i]=Es[i-1]
  else:
    Es[i]=Es[i-1]+1
    
for i in range(N, 0, -1):
  if S[i+1]=='W':
    Ws[i]=Ws[i+1]
  else:
    Ws[i]=Ws[i+1]+1
    
s=[Es[i]+Ws[i] for i in range(1, N+1)]
print(min(s))

Measured memory_bytes: 29688
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static System.Math;
using System.Text;
using System.Threading;
using System.Globalization;
using System.Runtime.CompilerServices;
using Library;

namespace Program
{
    public static class AGC041A
    {
        static public int numberOfRandomCases = 0;
        static public void MakeTestCase(List<string> _input, List<string> _output, ref Func<string[], bool> _outputChecker)
        {
        }
        static public void Solve()
        {
            var N = NN;
            var A = NN;
            var B = NN;
            if ((B - A) % 2 == 0)
            {
                Console.WriteLine((B - A) / 2);
            }
            else
            {
                var min = Min(A - 1, N - B);
                Console.WriteLine((B - A - 1) / 2 + min + 1);
            }
        }
        static class Console_
        {
            static Queue<string> param = new Queue<string>();
            public static string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }
        }
        class Printer : StreamWriter
        {
            public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
            public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }
            public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }
        }
        static public void Main(string[] args) { if (args.Length == 0) { Console.SetOut(new Printer(Console.OpenStandardOutput())); } var t = new Thread(Solve, 134217728); t.Start(); t.Join(); Console.Out.Flush(); }
        static long NN => long.Parse(Console_.NextString());
        static double ND => double.Parse(Console_.NextString());
        static string NS => Console_.NextString();
        static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();
        static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();
        static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();
        static IEnumerable<T> OrderByRand<T>(this IEnumerable<T> x) => x.OrderBy(_ => xorshift);
        static long Count<T>(this IEnumerable<T> x, Func<T, bool> pred) => Enumerable.Count(x, pred);
        static IEnumerable<T> Repeat<T>(T v, long n) => Enumerable.Repeat<T>(v, (int)n);
        static IEnumerable<int> Range(long s, long c) => Enumerable.Range((int)s, (int)c);
        static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }
        static IEnumerator<uint> _xsi = _xsc();
        static IEnumerator<uint> _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }
    }
}
namespace Library {
}


Measured memory_bytes: 14688
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FRE freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define all(v) (v).begin(),(v).end()
#define endl "\n"
#define int long long
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=a;i>b;i--)
#define vi vector<int>
#define pii pair<int,int>
#define mii map<int,int>
#define SET(A,VAL) memset(A, VAL, sizeof(A))
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
const int MAX = 1e6+8;
const int sz = 1e5+5;
void f_io(){
    IOS;
    
}
int32_t main(){
    f_io();
    int t = 1;
    //cin>>t;
    while(t--){
        int sx,sy,tx,ty;
        cin>>sx>>sy>>tx>>ty;
        string path= "";
        rep(i,0,(tx-sx)) path += 'R';
        rep(i,0,(ty-sy)) path += 'U';
        rep(i,0,(tx-sx)) path += 'L';
        rep(i,0,(ty-sy)) path += 'D';
        path += 'D';
        rep(i,0,(tx-sx) + 1) path += 'R';
        rep(i,0,(ty-sy) + 1) path += 'U';
        path += 'L';
        path += 'U';
        rep(i,0,(tx-sx) + 1) path += 'L';
        rep(i,0,(ty-sy) + 1) path += 'D';
        path += 'R';
        string s = "UURRURRDDDLLDLLULUUURRURRDDDLLDL";
        // cout<<s.size()<<endl;
        // cout<<path.size()<<endl;
        cout<<path<<endl;


    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <queue>
#include <deque>
#include <iomanip>
#include <cmath>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
 
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORE(i,a,b) for(int i=a;i<=b;i++)
#define ll long long 
//#define int long long
#define ld long double
#define vi vector<ll>
#define pb push_back
#define ff first
#define ss second
#define ii pair<int,int>
#define iii pair<int,ii>
#define il pair<ll,ll>
#define vv vector
//#define endl '\n'
using namespace std;
const int MAXN = 700 + 5;
 
set<ii> s[(1<<18)];
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int xx = n;
    n = (1<<n);
    int arr[n];
    FOR(i,n)cin >> arr[i];
    FOR(i,n)s[i].insert({arr[i],i});
    FOR(i,n){
    	FOR(j,xx){
    		int v = i|(1<<j);
    		if(v != i){
    			for(auto e: s[i])s[v].insert(e);
    			while(s[v].size() > 2)s[v].erase(s[v].begin());
    		}
    	}
    }
    int mx = 0;
    FOR(i,n){
    	int sum = 0;
    	for(auto e :s[i])sum += e.ff;
    	mx = max(mx,sum);
    	if(i > 0)cout << mx << endl;
    }
 
    return 0;
}

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

int main()
{

	while (true) {
		int n, x;
		cin >> n >> x;
		if (n == 0 && x == 0)
			break;
		int ans = 0;
		for (int a = 1; a < n -1; a++) {
			for (int b = a + 1; b < n ; b++) {
				for (int c = b + 1; c < n + 1; c++) {
					if (a + b + c == x) {
						ans++;
					}
				}
			}
		}
		cout << ans << endl;
	}

}


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

int main () {
  int i,j,N,K;
  cin >>N>>K;
  j=1;
  for(i=0;i<N;i++) {
    if (j<K) {
      j*=2;
    }
    else {
      j+=K;
    }
  }
  cout<<j<<endl;
}

Measured memory_bytes: 256
N=int(input())
X=[[0,0]]*N
for i in range(N):
    X[i]=list(map(int,input().split()))
X.sort()
right=X[0][0]+X[0][1]
count=0
for i in range(1,N):
    if right>X[i][0]-X[i][1]:
        count+=1
        right=min(X[i][0]+X[i][1],right)
    else:
        right=X[i][0]+X[i][1]
print(N-count)

Measured memory_bytes: 27872
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define Rep(i,n) for(int i=1;i<=(n);++i)
using LL = long long;
using ULL = unsigned long long;

LL dp[2001][2001];

int main()
{
	int n, a;
	cin >> n;
	vector<pair<int, int>> x;
	Rep(i, n) cin >> a, x.emplace_back(a, i);
	sort(x.begin(), x.end(), greater<pair<LL, int>>());
	Rep(i, n) {
		LL val = x[i-1].first;
		int pos = x[i-1].second;
		dp[i][0] = dp[i-1][0] + abs(n-i+1-pos) * val;
		for(int j = 1; j < i; ++j) dp[i][j] = max(dp[i-1][j-1] + abs(j-pos)*val, dp[i-1][j] + abs(n-i+j+1-pos)*val);
		dp[i][i] = dp[i-1][i-1] + abs(i-pos) * val;
	}
	LL ans = 0;
	for(int i = 0; i <= n; ++i) ans = max(ans, dp[n][i]);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 26272
#include <bits/stdc++.h>
#define ull unsigned long long
#define eps 5e-8
#define IT set<node>::iterator 
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;

int main(){
	int k;
	scanf("%d",&k);
	for(int i=1;i<=k;i++)	printf("ACL");
    return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int f(long long a, long long b) {
	int dig_a = 0, dig_b = 0;
	while (a) {
		++dig_a;
		a /= 10;
	}

	while (b) {
		++dig_b;
		b /= 10;
	}

	return max(dig_a, dig_b);
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	long long n;
	cin >> n;

	int ans = INT_MAX;
	for (long long i = 1; i * i <= n; ++i) {
		if (n % i == 0) {
			long long j = n / i;
			ans = min(ans, f(i, j));
		}
	}

	cout << ans << "\n";

	return 0;

}

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

sw2lmp = [[] for _ in range(N)]
for i in range(M):
    k, *s = map(int, input().split())
    s = tuple(map(lambda x: x - 1, s))
    for ss in s:
        sw2lmp[ss].append(i)
p = tuple(map(int, input().split()))

cnt = 0
for i in range(1 << N):
    state = [0] * M
    for j in range(N):
        if (i >> j) & 1:
            for lmp in sw2lmp[j]:
                state[lmp] += 1
    if all(x % 2 == p[i] for i, x in enumerate(state)):
        cnt += 1
print(cnt)


Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int leng = 5;
		int nums[] = new int[leng];
		
		int st = sc.nextInt();
		int ed = sc.nextInt();
		int count = 0;
		
		for(int i=st ; i<=ed;i++){
			int num = i;
			for(int j=0;j<leng;j++){
				nums[j] = num / (int)Math.pow(10, leng-(j+1));
				num = num - nums[j] * (int)Math.pow(10, leng-(j+1));
			}
			
			if(nums[0] == nums[4] && nums[1] == nums[3]){
				count++;
			}
			
		}
		
		System.out.println(count);
	}
}

Measured memory_bytes: 22996
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1001001001;
const double PI = acos(-1);


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

	int a = n / 1000;
	if (n % 1000 != 0) {
		a++;
	}

	int ans = 1000*a - n;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3628
// Problem : C - Sum of product of pairs
// Contest : AtCoder - AtCoder Beginner Contest 177
// URL : https://atcoder.jp/contests/abc177/tasks/abc177_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

///Astalavista Code........~boy_with_no_gf
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define Br cout<<endl
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define PT(x) cout << (x) << endl
#define PTT(x) cout << (#x) << " is " << (x) << endl
#define lets_go ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int M = 1e9 + 7;
const int N = 2e6 + 10;
const int IM = 1e15 + 37;
const double PI = 3.1415926535897932384;
inline void PP(int n) { cout << n << " ";}
void PV(vi v) { for (int i = 0 ; i < v.size() ; i++) cout << v[i] << " " ; cout << endl;}
void PVV(vii v) {for (int i = 0 ; i < v.size() ; i++) cout << v[i].first << " " << v[i].second << endl;}
void PA(int v[], int n, int x = 0) { for (int i = x ; i < n + x; i++)cout << v[i] << ' ' ; cout << endl;}
void IN(int a[], int n, int x = 0) {for (int i = x; i < n + x; i++)cin >> a[i];}

// <=================================================================================================================================
// <=================================================================================================================================

void fun(){
	int n;cin>>n;
	vi arr(n);
	for(int i=0;i<n;i++)cin>>arr[i];
	vi pre(n+1,0);
	for(int i=n-1;i>=0;i--){
		pre[i]=pre[i+1]+arr[i];
	}
	int ans=0;
	for(int i=0;i<n;i++){
		ans=(ans+((arr[i]%M)*(pre[i+1]%M))%M)%M;	
	}
	cout<<ans;
}

signed  main() {
    lets_go

    int t;
    t=1;
//    cin >> t;
    while (t--) {

    fun();

    }



    return 0;

}


Measured memory_bytes: 6372
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n = int(input())
    a = [int(x) for x in input().split()]
    b = [int(x) for x in input().split()]
    if sum(a) < sum(b):
        print(-1)
        return

    pos = []
    neg = 0
    for i in range(n):
        x = a[i] - b[i]
        if x >= 0:
            pos.append(x)
        else:
            neg += -x
    pos.sort(reverse=True)
    m = len(pos)
    i = 0
    cur = 0
    while i < m and cur < neg:
        cur += pos[i]
        i += 1
    print(n - len(pos) + i)
    


    
    
    
t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

R s
S p
P r

"""


Measured memory_bytes: 24244
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [S] = [(input_raw[0])]
    if S=="Sunny":
        print "Cloudy"
    elif S =="Cloudy":
        print "Rainy"
    else:
        print "Sunny"

if __name__ == '__main__':
    main()


Measured memory_bytes: 2932
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  
  int K,S;
  cin >> K >> S;
  
  //何通りあるか
  long long ans = 0;
  
  for( int x = 0; x < K+1; x++){
    for( int y = 0; y < K+1; y++){ 
      
      int z = S - x - y;
      if( 0 <= z && z <= K ) ans++;
        
    }
  }
  
  printf("%lld\n",ans);
  
  return 0;
 
}

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

const int MAXN = 200005;

int n, a[MAXN];
int c[MAXN], dx[MAXN], dx_top = 0;

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]), c[i] = a[i];
	int x1 = n/2, x2 = x1+1;
	nth_element(a+1, a+x1, a+n+1);
	int x = a[x1];
	nth_element(a+1, a+x2, a+n+1);
	int y = a[x2];
	// cerr << x << " " << y << endl;
	for (int i = 1; i <= n; i++) {
		if (c[i] <= x) printf("%d\n", y);
		else printf("%d\n", x);
	}
	return 0;
}


Measured memory_bytes: 3712
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

int main()
{
    int n, l, ans = 0;
    std::cin >> n;
    std::vector<int> vec;
    for (int i = 0; i < 2 * n; i++)
    {
        std::cin >> l;
        vec.push_back(l);
    }
    std::sort(vec.begin(), vec.end());
    for (int i = 0; i < (2 * n) - 1; i += 2) { ans += std::min(vec[i], vec[i + 1]); }
    std::cout << ans << std::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)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
#define mk_p(a,b)	make_pair((a),(b))
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr long long MOD = 1000000007;

int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,a,b;
	cin >> n >> a >> b;
	cout << min(a * n,b) << '\n';
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define MAXN 100010
#define MO 1000000007
#define LL long long
int x[MAXN],n,m;
bool vis[MAXN];
struct node
{
	LL a[3][3];
}A,C,a,b,c,tmp;
void Mul(node &ret,node X,node Y)
{
	for(int i=0;i<3;i++)
		for(int j=0;j<3;j++)
			tmp.a[i][j]=0;
	for(int i=0;i<3;i++)
		for(int j=0;j<3;j++)
			for(int k=0;k<3;k++)
				tmp.a[i][j]=(tmp.a[i][j]+X.a[i][k]*Y.a[k][j]%MO)%MO;
	for(int i=0;i<3;i++)
		for(int j=0;j<3;j++)
			ret.a[i][j]=tmp.a[i][j];
}
void Pow(int X)
{
	for(int i=0;i<3;i++)
		for(int j=0;j<3;j++)
			c.a[i][j]=C.a[i][j];
	while(X)
	{
		if(X&1) Mul(a,a,c);
		Mul(c,c,c);
		X>>=1;
	}
}
int f[3],g[3];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
		scanf("%d",&x[i]);
	memset(A.a,0,sizeof A.a);
	memset(C.a,0,sizeof C.a);
	A.a[0][0]=A.a[1][1]=A.a[2][2]=A.a[1][2]=A.a[0][2]=1;
	A.a[0][1]=2;
	C.a[0][2]=C.a[1][0]=C.a[1][1]=C.a[1][2]=C.a[2][0]=C.a[2][2]=1;
	C.a[0][0]=C.a[0][1]=2;
	f[0]=1;
	x[++m]=n;
	for(int l=1,pos=0;l<=m;l++)
	{
		int k=x[l]-pos-1;
		memset(b.a,0,sizeof b.a);
		memset(a.a,0,sizeof a.a);
		for(int i=0;i<3;i++)
			a.a[i][i]=1;
		if(k) Pow(k);
		Mul(b,a,A);
		for(int i=0;i<3;i++)
		{
			g[i]=0;
			for(int j=0;j<3;j++)
				g[i]=(g[i]+f[j]*b.a[j][i]%MO)%MO;
		}
		for(int i=0;i<3;i++)
			f[i]=g[i];
		pos=x[l];
	}
	printf("%d\n",f[2]);
}


Measured memory_bytes: 512
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
strs="".join(s)
strt="".join(t)
list1=[strs,strt]
str1=list1[0]
list1.sort()
if s==t:
    print("No")
elif str1==list1[0]:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
using System;
using System.Linq;

namespace Aizu
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine();
            var inputs = input.Split(' ');

            var ints = new[]
            {
                int.Parse(inputs[0]),
                int.Parse(inputs[1]),
                int.Parse(inputs[2])
            };

            Console.WriteLine(string.Join(" ", ints.Select(i => i.ToString()).OrderBy(i => i).ToArray()));
        }
    }
}

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

int		is_nbr_possible()
{
	int			N, M, s;
	char		c;
	int			r, i;
	char		*nbr;

	i = 0;
	r = scanf("%d %d\n", &N, &M);
	if (!r)
		return (0);
	nbr = (char *)malloc(sizeof(char) * (N + 2));
	for (int n = 0; n < (N + 2); n++)
		nbr[n] = 'A';
	for (int i = 0; i < M; i++)
	{
		r = scanf("%d %c", &s, &c);
		if (!r)
			return (0);
		if (nbr[s] == 'A' || nbr[s] == c)
			nbr[s] = c;
		else
			return (-1);
	}
	if (N > 1)
	{
		if (nbr[1] == '0')
			return (-1);
		if (nbr[1] == 'A')
			nbr[1] = '1';
	}
	while (i < (N + 1))
	{
		if (nbr[i] == 'A')
			nbr[i] = '0';
		i++;
	}
	nbr[i] = '\0';
	nbr++;
	printf("%s\n", nbr);
	return (0);
}

int		main()
{
	int		no_result;

	no_result = is_nbr_possible();
	if (no_result)
		printf("%d\n", no_result);
	return (0);
}


Measured memory_bytes: 128
// Problem : C - H and V
// Contest : AtCoder - AtCoder Beginner Contest 173
// URL : https://atcoder.jp/contests/abc173/tasks/abc173_c
// Memory Limit : 1024 MB
// Time Limit : 1000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define all(x) begin(x),end(x)

int mod = 1e9+7;
int inf = 4e18;
const int N = 5e5+5;
		
signed main()
{
    io
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {
		int h,w,kk;
		cin>>h>>w>>kk;
		char arr[h][w];
		for(int i=0;i<h;++i)
		{
			for(int j=0;j<w;++j)
			{
				cin>>arr[i][j];
			}
		}
		int ans = 0;
		for(int i=0;i<(1<<h);++i)
		{
			for(int j=0;j<(1<<w);++j)
			{
				int ct = 0;
				for(int k=0;k<h;++k)
				{
					if((1<<k)&i)
					continue;
					for(int l=0;l<w;++l)
					{
						if((1<<l)&j)
						continue;
						if(arr[k][l]=='#')
						++ct;
					}
				}
				if(ct==kk)
				++ans;
			}
		}
		cout<<ans<<"\n";		
    }
    return 0;
}


Measured memory_bytes: 3632