akhauriyash/Code-Regression huggingface dataset:
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();
    int c = sc.nextInt();

    String ans = "No";

    if(((a == b) && (c != a)) || ((b == c) && (a != b)) || ((c == a) && (b != c))){
      ans = "Yes";
    }

    System.out.println(ans);
  }
}

Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	vector <string> s;
	cin >> a >> b;
	for(int i=0; i<a; ++i){string c;cin >> c; s.emplace_back(c);}
	sort(s.begin(), s.end());
	for(int i=0; i < s.size(); ++i){cout << s[i];}

 return 0;
 
 }


Measured memory_bytes: 256
use std::cmp;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let s: Vec<_> = sc
        .chars()
        .into_iter()
        .map(|c| c as usize - 'a' as usize)
        .collect();
    let n = s.len();

    let mut hash: usize = 0;
    let mut min: Vec<u32> = vec![n as u32; 1 << 26];
    for i in 0..n {
        hash ^= 1 << s[i];
        let mut ans = n as u32;
        if hash.count_ones() <= 1 {
            ans = 1;
        } else {
            for j in 0..26 {
                ans = cmp::min(ans, min[hash ^ (1 << j)] + 1);
            }
            ans = cmp::min(ans, min[hash]);
        }
        min[hash] = cmp::min(min[hash], ans);
        if i == n - 1 {
            println!("{}", ans);
        }
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 268540
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;
#define N (1000000000+7)

int main(void) {
	ll p = 0, g = 0;
	string s;
	cin >> s;
	for (ll i = 0;i < s.length();i++) {
		if (s[i] == 'g')g++;
		else p++;
	}
	if (s.length() % 2 == 0) {
		if (g <= p)cout << g - s.length() / 2 << endl;
		else cout << s.length() / 2 - p << endl;
	}
	else {
		if (p > g)cout << g - (s.length() + 1) / 2 << endl;
		else cout << s.length() / 2 - p << endl;
	}
	return 0;
}

Measured memory_bytes: 512
import math
n,m=map(int,input().split())

l=list(map(int,input().split()))
s=sum(l)
ans=0
t=s/(4*m)
for i in l:
    if i>=math.ceil(t):
        ans+=1
if ans>=m:
    print("Yes")
else:
    print("No")
    


Measured memory_bytes: 3060
#include <stdio.h>

int main()
{
  int input_d, input_w;
  int input_e[10][10];
  int okuyuki, haba;
  int moving_yoko, moving_tate;
  int counter_i, counter_j;

  for( ; ; )
  {
    int in_max_height = 0, out_min_height = 9;
    int sum_deepth = 0, max_deepth = 0;

    scanf("%d %d", &input_d, &input_w);
    if(input_d == 0 && input_w == 0)
      break;

    for(counter_i = 0 ; counter_i < input_d ; counter_i++)
    {
      for(counter_j = 0 ; counter_j < input_w ; counter_j++)
        scanf("%d", &input_e[counter_i][counter_j]);
    }

    for(okuyuki = 0 ; okuyuki <= input_d - 3 ; okuyuki++)
    {
      for(haba = 0 ; haba <= input_w - 3 ; haba++)
      {
        for(moving_tate = 0 ; moving_tate <= input_d - 3 - okuyuki ; moving_tate++)
        {
          for(moving_yoko = 0 ; moving_yoko <= input_w - 3 - haba ; moving_yoko++)
          {
            for(counter_i = moving_tate ; counter_i <= okuyuki + 2 + moving_tate ; counter_i++)
            {
              for(counter_j = moving_yoko ; counter_j <= haba + 2 + moving_yoko ; counter_j++)
              {
                if(moving_tate < counter_i && counter_i < okuyuki + 2 + moving_tate)
                {
                  if(moving_yoko < counter_j && counter_j < haba + 2 + moving_yoko)
                  {
                    if(in_max_height < input_e[counter_i][counter_j])
                    {
                      in_max_height = input_e[counter_i][counter_j];
                    }
                  }
                  else
                  {
                    if(out_min_height > input_e[counter_i][counter_j])
                    {
                      out_min_height = input_e[counter_i][counter_j];
                    }
                  }
                }
                else
                {
                  if(out_min_height > input_e[counter_i][counter_j])
                  {
                    out_min_height = input_e[counter_i][counter_j];
                  }
                }
              }
            }
            if(out_min_height <= in_max_height)
            {
              in_max_height = 0;
              out_min_height = 9;
              continue;
            }
            for(counter_i = moving_tate + 1 ; counter_i < okuyuki + 2 + moving_tate ; counter_i++)
            {
              for(counter_j = moving_yoko + 1 ; counter_j < haba + 2 + moving_yoko ; counter_j++)
              {
                sum_deepth = sum_deepth + (out_min_height - input_e[counter_i][counter_j]);
              }
            }
            if(max_deepth < sum_deepth)
            {
              max_deepth = sum_deepth;
            }
            sum_deepth = 0;
          }
        }
      }
    }

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



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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl


int main(){
    int n;
    cin >> n;
    string t;
    set<string> set1;
    REP(i,n){
        cin >> t;
        set1.insert(t);
    }
    COUT(set1.size());
    return 0;
}

Measured memory_bytes: 19200
a, b, aC = gets.chomp.split(" ").map(&:to_i)

rC = ( aC * Math::PI/ 180.0 ) 

puts a * b * Math.sin(rC) / 2
puts a + b + (a ** 2 + b ** 2 - 2 * a * b * Math.cos(rC)) ** (1/2.0)
puts b * Math.sin(rC)


Measured memory_bytes: 6932
#include <iostream>
using namespace std;
int main(){
int a, b;
	cin >> a >> b;

	if (a == b) cout << "Draw" ;
	else if (a == 1) cout << "Alice" ;
	else if (b == 1) cout << "Bob" ;
	else if (a > b) cout << "Alice";
	else cout << "Bob" << endl;

  return 0;
}

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

int main () {
  int N, M;
  cin >> N >> M;

  vector<int> A(M, 0);
  for (int i = 0; i < M; i++) {
    cin >> A.at(i);
  }
  
  int free = N;
  for (int i = 0; i < M; i++) {
    free -= A.at(i);
  }
  
  if (free >= 0) {
    cout << free;
  } else {
    cout << "-1";
  }
}

Measured memory_bytes: 3640
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    cout << s.substr(0, 3) << endl;
}

Measured memory_bytes: 3620
N = int(input())
d = {}
if N % 2 == 0:
    for i in range(N//2):
        d[2*i+1] = 0
else:
    for i in range(N//2+1):
        d[2*i] = 0
A = list(map(int,input().split()))
x = 1
for i in range(N):
    if A[i] in d:
        if d[A[i]] >= 2:
            x = 0
            break
        else:
            d[A[i]] += 1
    else:
        x = 0
        break
y = 1
if N % 2 == 1:
    if d[0] != 1:
        y = 0
e = 10**9 + 7
ans = (2**(N//2))*x*y%e
print(ans)

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

int main() {
  string a = "qwertasdfgzxcvb";
  string b = "yuiophjklnm";
  string s;
  while (getline(cin, s)) {
    if (s == "#") {
      break;
    }
    if (s.size() == 1) {
      cout << 0 << endl;
      continue;
    }
    vector<int> c;
    for (int i = 0; i < s.size(); i++) {
      for (int j = 0; j < a.size(); j++) {
        if (s[i] == a[j]) {
          c.push_back(0);
        }
      }
      for (int j = 0; j < b.size(); j++) {
        if (s[i] == b[j]) {
          c.push_back(1);
        }
      }
    }
    int ans = 0, x = c[0];
    for (int i = 1; i < c.size(); i++) {
      if (x != c[i]) {
        ans++;
        x = c[i];
      }
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3204
#include<cstdio>
using namespace std;
int a,b;
int main(){
    scanf("%d%d",&a,&b);
    if(a>0)puts("Positive"); 
    else if(b>=0)puts("Zero");
    else if((a&1)^(b&1))
    puts("Positive");
    else puts("Negative");
    return 0;
}

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

const int MAXDIGIT = 50;

ll dp[60][2];

int main(){
  int n;
  ll k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  memset(dp,-1, sizeof(dp));
  dp[0][0] = 0;
  rep(d,MAXDIGIT) {
    ll bit = 1LL << (MAXDIGIT - d - 1);
    int bit_sum = 0;
    rep(i,n) if(a[i] & bit) bit_sum++;
    ll cost0 = bit_sum * bit;
    ll cost1 = (n - bit_sum ) * bit;

    if (dp[d][1] != -1) dp[d+1][1] = max(dp[d+1][1], dp[d][1] + max(cost0, cost1));
    if (dp[d][0] != -1) {
      if (k & bit) {
        dp[d+1][1] = max(dp[d+1][1], dp[d][0] + cost0);
        dp[d+1][0] = max(dp[d+1][0], dp[d][0] + cost1);
      } else {
        dp[d+1][0] = max(dp[d+1][0], dp[d][0] + cost0);
      }
    } 
  }
  cout << max(dp[MAXDIGIT][0], dp[MAXDIGIT][1]) << endl;
  return 0;
} 

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    string s;
    cin >> s;
    if (s == "Sunny")
        OP("Cloudy");
    else if (s == "Cloudy")
        OP("Rainy");
    else if (s == "Rainy")
        OP("Sunny");

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef vector<int> vec;
int main(){
  vec data={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k; cin>>k;
  cout<<data[k-1];
  
}


Measured memory_bytes: 256
def g;gets.split.map &:to_i;end
while(c,n,m,s,d=g)[0]>0
l=(0..n).map{{}}
m.times{a,b,f=g;l[a][b]=l[b][a]=f}
q=[[0,s]+[0]*c]
until(o,i,*a=q.sort!.shift;i==d)
l.map{|h|h.delete i}
l[i].map{|k,v|t,*u=(a+[v]).sort;q<<[o+v/2+t/2,k]+u}
end
p o
end

Measured memory_bytes: 6392
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <numeric>
#include <algorithm>
#include <math.h>

using namespace std;

int main(){
    vector<int> nums(3);
    int maxNum = 0;
    for(int i=0;i<3;i++){
        cin >> nums[i];
        maxNum = max(maxNum, nums[i]);
    }

    int ans = 0;
    for(int i=0;i<3;i++){
        while ( nums[i] < maxNum - 1 ){
            nums[i] += 2;
            ans++;
        }
    }

    int sameNums = 0;
    for(int i=0;i<2;i++){
        for(int j=i+1;j<3;j++){
            if( nums[i] == nums[j] )    sameNums++;
        }
    }
    if( sameNums == 1 ){
        for(int i=0;i<3;i++){
            if( nums[i] == maxNum ) ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int N,M,ans=0;
int d[100001];

int root(int a){
	if(d[a]==a)return a;
	else return d[a]=root(d[a]);
}

void unite(int a,int b){
	a=root(a);
	b=root(b);
	if(a==b)return;
	
	d[a]=b;
}

int query(int a,int b){
	if(root(a)==root(b))return 1;
	else return 0;
}

int main(){
	scanf("%d%d",&N,&M);
	for(int i=1;i<=N;i++)d[i]=i;
	int p[N+1];
	for(int i=1;i<=N;i++)scanf("%d",&p[i]);
	for(int i=0;i<M;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		unite(x,y);
	}
	for(int i=1;i<=N;i++)if(query(p[i],i)==1)ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 896
N = int(input())
A = list(map(int, input().split()))
M = int(input())
S = sum(A)
P = [0] * M
X = [0] * M
for i in range(M):
    P[i], X[i] = list(map(int, input().split()))
for i in range(M):
    print(S + X[i] - A[P[i]-1])


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

using namespace std;

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL);
    int n, x; cin >> n;
    map<int, int> cnt;
    for(int i = 1; i <= n; i++) cin >> x, cnt[x]++;

    int res = 0;
    for(auto x: cnt) 
        if (x.second > x.first) res += x.second - x.first;
        else if (x.second < x.first) res += x.second;
    cout << res;
}


Measured memory_bytes: 4736
S = input()
K = int(input())
one = 0
for i in range(len(S)):
  tmp = S[i]
  if(tmp == "1"):
    one += 1
  else:
    ans = tmp
    if(one >= K):
      print("1")
      exit()
    else:
      print(str(ans))
      exit()
print("1")

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

int main()
{
    long long a,b,c,d;
    cin >> a >> b >> c >> d;
    long long x,y;
    x = (c+b-1)/b;
    y = (a+d-1)/d;
    if(x <= y)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
}

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

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)///

int f(int x) {
	if (x == 2)return 0;
	if (x == 4 || x == 6 || x == 9 || x == 11)return 1;
	return 2;
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x, y;
	cin >> x >> y;
	if (f(x) == f(y))cout << "Yes" << endl;
	else cout << "No" << endl;
}


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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), a[] = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = sc.nextInt();
		Arrays.sort(a);
		long sum = a[n - 1];
		int countVal = n - 2, curInd = n - 2;
		while (countVal > 0) {
			sum += a[curInd];
			--countVal;
			if (countVal > 0) {
				sum += a[curInd];
				--countVal;
				curInd--;
			}
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 60432
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1000000000007
int main() {
	// your code goes here
	ll n,k;
	cin>>n>>k;
	ll a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	//ll ans =0;
	ll dp[n];
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
   // cout<<dp[1]<<endl;
    for(ll i=2;i<n;i++)
    {
      dp[i]=inf;
    for(ll j=1;j<=min(i,k);j++){
    {
    //	cout<<dp[i]<<" "<<j<<" "<<dp[i-j]+abs(a[i]-a[i-j])<<endl;
    	dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
        
    }
    
   // cout<<dp[i]<<endl;
    }
    
    }
    cout<<dp[n-1];
	return 0;
}


Measured memory_bytes: 5152
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());

            boolean ok = false;
            for (int i = 0; i <= n / 4; i++) {
                for (int j = 0; j <= n / 7; j++) {
                    if ((4 * i + 7 * j) == n) ok = true;
                }
            }
            // 出力
            out.println(ok ? "Yes" : "No");

        }

    }
}



Measured memory_bytes: 22996
#include<stdio.h>
int main()
{
    char s[3];
    int a=700,i;
    scanf("%s",s);
    for(i=0;i<3;i++)
    {
        if(s[i]=='o')
        {
            a=a+100;
        }
    }
    printf("%d",a);
    return 0;
}

Measured memory_bytes: 128
#define DIN freopen("input.txt","r",stdin);
#define DOUT freopen("output.txt","w",stdout);
#include <bits/stdc++.h>
#include <cstdio>
#define mem(a,b) memset(a,b,sizeof(a))
#define REP(i,a,b) for(int i=(a);i<=(int)(b);i++)
#define REP_(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
using namespace std;
typedef long long LL;
typedef std::vector<int> VI;
typedef std::pair<int,int> P;
int read()
{
    int x=0,flag=1; char c=getchar();
    while((c>'9' || c<'0') && c!='-') c=getchar();
    if(c=='-') flag=0,c=getchar();
    while(c<='9' && c>='0') {x=(x<<3)+(x<<1)+c-'0';c=getchar();}
    return flag?x:-x;
}

int main()
{
    int a[105],n;
    n=read();
    REP(i,1,n) a[i]=read();
    sort(a+1,a+n+1);
    int ans=0;
    for(int i=1;i<n;i++)
        for(int j=i+1;j<n;j++)
            for(int k=j+1;k<=n;k++)
                if(a[i]+a[j]>a[k] && a[i]!=a[j] && a[j]!=a[k])
                    ans++;
    cout<<ans;
    
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    char c = s[0];
    int ans = 1;
    for (int i = 0; i < n; ++i) {
        if (c != s[i]) {
            c = s[i];
            ans += 1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
// ABC083_B
#include <iostream>
#include <string>
#include <vector>
#include <iterator>  // std::prev(iter, n) n 個分デクリメントしたイテレータ
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define MIN(vec) min_element(vec.begin(), vec.end())  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(vec.begin(), vec.end())
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(vec.begin(), vec.end(), 0LL)  // 0 は初期値
#define pll pair<ll, ll>
#define F first
#define S second
const ll INF = 1LL<<60;  // 10^18

ll digitSum(ll N) {
    ll res = 0;
    while (N != 0) {
        res += N%10;
        N /= 10;
    }
    return res;
}

int main() {
    // input(sunippets: inpv, inpn, inps)
    ll N, A, B;
    cin >> N >> A >> B;
    
    // calculation
    ll num, res = 0;
    for (ll i = 1; i <= N; ++i) {
        num = digitSum(i);
        if (A <= num && num <= B) res += i;
    }
    
    cout << res << "\n";
    
    return 0;
}

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

#define         eps         10e-9
#define         pi          2*acos(0)
#define         P1          1e9+7
#define         P2          1e9+9
#define         lli         long long int

using namespace std;

///ISNNJB

/**int fx[]={+1,-1,+0,+0};
int fy[]={+0,+0,+1,-1};
int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};
int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};*/

int main()
{
    /***freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/

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

    lli h,w,ans;
    cin>>h>>w;
    if(h==1||w==1)
        cout<<"1\n";
    else
    {
        ans = ceil((h*w*1.0)/2.0);
        cout<<ans<<"\n";
    }

    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;

#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define eb emplace_back
#define el '\n'
typedef  long long  ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;


const int mod=1000000007;
//const int mod=998244353;





int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll t,n,m,k,q,x,a,b,c,d;
    cin >> n;
    vpll v(n);
    for(int i=0; i<n; i++){
        cin>> v[i].se>> v[i].fi;
    }
    sort(all(v));
    a=0;
    for(int i=0; i<n; i++){
        if(a+v[i].se<=v[i].fi)
            a+=v[i].se;
        else{
            cout<<"No"<<el;
            return 0;
        }
    }
    cout<< "Yes" << el;

    
    return 0;
}



Measured memory_bytes: 3328
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
#define BUF_SIZE 20

// size: specify sizeof(str)
int get_str(char *str, int size) {
    if(!fgets(str, size, stdin)) return -1;
    return 0;
}

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}

int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
  return 0;
}

struct magic {
    int damage;
    int consume;
};

#define MAGICS_MAX 1000
#define HP_MAX 10000

int main(void) {
    int hp, num;
    static struct magic magics[MAGICS_MAX];
    static int dp[HP_MAX+1];
    memset(dp, 0x3f, sizeof(int)*(HP_MAX+1));
    dp[0] = 0;
    get_int2(&hp, &num);
    int i;
    for(i = 0; i < num; i++) {
        get_int2(&magics[i].damage, &magics[i].consume);
    }

    int h;
    for(i = 0; i < num; i++) {
        int d = magics[i].damage;
        int m = magics[i].consume;
        for(h = 1; h <= hp; h++) {
            dp[h] = min(dp[h], dp[max(0, h-d)] + m);
        }
#ifdef DEBUG
        printf("%d: %d\n", i, dp[hp]);
#endif
    }
    printf("%d\n", dp[hp]);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

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

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

int main()
{
  int N; cin >> N;
  vector<queue<int>> A(N);
  unordered_set<int> set;
  for (int i = 0; i < N; i++)
  {
    for (int j = 0; j < N - 1; j++)
    {
      int x; cin >> x; x--;
      A[i].push(x);
    }
    set.insert(i);
  }
  int cnt = 0;
  int ans = 0;
  while (cnt < N * (N - 1)) {
    vector<bool> check(N, false);
    unordered_set<int> nextset;
    for (int i : set)
    {
      if (A[i].empty()) continue;
      if (A[A[i].front()].front() == i) {
        check[i] = true;
        check[A[i].front()] = true;
        nextset.insert(i);
        nextset.insert(A[i].front());
      }
    }
    if (nextset.empty()) {
      ans = -1;
      break;
    }
    for (int i : nextset)
    {
      if (check[i]) {
        A[i].pop();
        cnt++;
      }
    }
    set = nextset;
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int h,w;
    cin >> h >> w;
    int cnt=0;
    vector<string> mappu(h);
    rep(i,h) cin >> mappu[i];
    rep(i,h){
        rep(j,w){
            if(mappu[i][j] == '#') cnt++;
        }
    }
    if(cnt == h+w-1) cout << "Possible" << endl;
    else cout << "Impossible" <<endl;
    
    
}

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


#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
ll f[5000009],inv[5000009];
const ll mod= 998244353;
void pre(){
	f[0]=f[1]=1;
	inv[0]=inv[1]=1;
	repA(i,2,5000000){
		f[i]=f[i-1]*i%mod;
		inv[i]=mod-(mod/i)*inv[mod%i]%mod;
	}
	repA(i,2,5000000) inv[i]=inv[i-1]*inv[i]%mod;

}
ll C(int n,int r){
	if(r<0||r>n) return 0;
	return f[n]*inv[r]%mod*inv[n-r]%mod;
}
void solve(){


}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	pre();
	int n;cin>>n;
	int m;cin>>m;
	ll ans = C(3*m+n-1,n-1);
	rep(i,m){
		ans-=C(i+n-2,n-2)*n%mod;
	}
	repA(i,m+2,n){
		ans-=1ll*C(n,i)*C((3*m-i)/2+n-1,n-1)%mod;
		i++;
	}
	cout<<(ans%mod+mod)%mod;
	return 0;
}



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

int main() {
  int A;
  int N;
  cin >> N >> A;
  
  if (N % 500 <= A) {
    cout << "Yes" << endl;  
  }
  else if (N % 500 > A) {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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

char X,Y;

int main(){
    cin>>X>>Y;
    if(X==Y){
        out("=");
    }
    else if(X>Y){
        out(">");
    }
    else{
        out("<");
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9+5;
const ll INFLL = 1e18l+5;
const int mod = 1e9+7;

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

int main(){
    int H,W;
    cin>>H>>W;
    char sq[H][W];
    for(int i=0; i<H; i++){
        scanf("%s", sq[i]);
    }
    vector<vector<int>> dp(H, vector<int>(W,0));
    dp[0][0]=1;
    for(int i=0; i<H; ++i){
        for(int j=0; j<W; ++j){
            for(int ai : {i, i+1}){
                int bi=j;
                if(ai==i) bi=j+1;
                if(ai<H&&bi<W&&sq[ai][bi]=='.')
                    self_max(dp[ai][bi], dp[i][j]);
            }
        }
    }

    cout<<dp[H-1][W-1];
}

Measured memory_bytes: 8568
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define LLPair pair<ll, ll>
#define vint vector<int>
#define vll vector<ll>
typedef long long ll;

using namespace std;

struct Point { int x, y; };
struct Edge { int from, to, cost; };
struct gNode { int from, to, cost; };
struct tNode { int value; int parent; vector<int> child; };

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

int gcd(int a, int b){ return a % b == 0 ? b : gcd(b, a%b); }
int lcm(int a, int b){ return a * b/ gcd(a, b); }
int extgcd(int a, int b, int& x, int& y){
	int d = a;
	if(b != 0){
		d = extgcd(b, a%b, y, x);
		y -= (a/b) * x;
	} else{
		x = 1; y = 0;
	}
	return d;
}
ll mod_pow(ll x, ll n){
	if(n == 0) return 1;
	ll res = mod_pow(x*x % MOD, n/2);
	if(n & 1) res = res * x % MOD;
	return res;
}

int main(void){
	int n, k; cin >> n >> k;
	vint a(n);
	rep(i, n) cin >> a[i];
	int ans  = 0;
	rep(i, n){
		if(a[i] >= k) ans++;
	}
	cout << ans << endl;
	return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        new Program().Calc();
    }

    Scanner cin;

    public Program() { }

    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    void Calc()
    {
        cin = new Scanner();

        int N = cin.nextInt();
        int L = cin.nextInt();

        int sum = 0;
        for (int i = 0; i < N; ++i)
        {
            sum += L + i;
        }

        if (L > 0)
        {
            sum -= L;
        }
        else if (L + N - 1 < 0)
        {
            sum -= L + N - 1;
        }

        WriteLine(sum);
    }
}

public static class StringExtension
{
    public static char GetChar1(this string str, int indexOneBase)
    {
        return str[indexOneBase - 1];
    }
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13140
# B問題
S = input()
var_str = {'a':0,'b':0,'c':0}
var_list = []

for i in S:
	var_str[i] += 1

for i,j in var_str.items():
	var_list.append((i,j))

var_list.sort(key = lambda x:x[1])

first = var_list[-1][1]
second = var_list[1][1]
third = var_list[0][1]

first -= third 
second -= third

if first <= 1 and second <= 1:
	print("YES")
else:
	print("NO")


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

int main(){
    int n;string s;
    cin>>n>>s;
    bool x = 0;
    for(int i=0;i<n/2;i++){
        if(s[i]!=s[i+n/2]){
            x = 0;
            break;
        }
        else x=1;
    }
    if(n%2==1) x=0;
    if(x) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<ll, ll> pl;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int n, m;
  cin >> n >> m;
  vector<ll> a(n);
  for (auto &v : a) cin >> v;
  for (int i = 0; i < n-1; i++) a[i+1] += a[i];
  for (int i = 0; i < n; i++) a[i] %= m;
  sort(a.begin(), a.end());
  ll cnt;
  ll sum = 0;
  for (int i = 0; i < n-1; i++) {
    cnt = 1;
    if (a[i] == 0) sum++;
    while (i < n-1 && a[i] == a[i+1]) {
      if (a[i+1] == 0) sum++;
      i++;
      cnt++;
    }
    sum += cnt*(cnt-1)/2;
  }
  if (n == 1) {
    if (a[0] == 0) sum++;
  }
  dump(sum);
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int a, b, c, m;
int main() {
	cin >> a >> b >> c >> m;
	int maxi=0;
	maxi=max(a, max(b, c));
	if(maxi==a){
	    while(m--) a*=2;
	    cout << a+b+c << endl;
	}
	else if(maxi==b) {
	    while(m--) b*=2;
	    cout << a+b+c << endl;
	}
	else {
	    while(m--) c*=2;
	    cout << a+b+c << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
inline ll f(ll a){
    return a?f(a/10)+1:0;
}
inline ll f(ll a,ll b){
    return max(f(a),f(b));
}
main(){
    ll n,m,s=11;
    scanf("%lld",&n);
    m=sqrt(n);
    for(register ll i=1;i<=m;++i)if(n%i==0)s=min(s,f(i,n/i));
    printf("%lld",s);
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
using namespace std;

int main() {
    int a;
    string s;
    cin >> a >> s;

    if(a >= 3200){
        cout << s << endl;
    }
    else {
        cout << "red" << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N=Integer.parseInt(sc.nextLine());
		String[] S=sc.nextLine().split("");
		int[] black_data = new int[N+1];
		int[] white_data = new int[N+1];

		// 累積和の生成(黒)
		for(int i=0;i<S.length;i++) {
			if(S[i].equals("#")) {
				black_data[i+1]=black_data[i]+1;
			}
			else {
				black_data[i+1]=black_data[i];
			}
		}
		
		// 累積和の生成(白)
		for(int i=0;i<S.length;i++) {
			if(S[i].equals(".")) {
				white_data[i+1]=white_data[i]+1;
			}
			else {
				white_data[i+1]=white_data[i];
			}
		}
		
		// 白と黒の数を足して、最小数をチェック
		int min_value=9999999;
		int value=0;
		for(int i=0;i<=N;i++) {
			value = black_data[i] + white_data[N] - white_data[i];
			min_value=Math.min(min_value,value);
		}
		System.out.println(min_value);
	}
}

Measured memory_bytes: 54008
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;
const long double EPS = 1e-10;

int main() {
  int n;
  cin >> n;
  string a, b, c;
  cin >> a >> b >> c;
  
  int ans = 2 * n;
  rep(i, n) {
    if (a[i] == b[i] || b[i] == c[i] || c[i] == a[i]) ans--;
    if (a[i] == b[i] && b[i] == c[i]) ans--;
  }

  cout << ans << endl;

  
  return 0;
}

Measured memory_bytes: 256
import sys

S, K = [int(i) for i in input()], int(input())

if S[0] == 1:
    length = 1
    for i in range(1, len(S)):
        if S[i] == 1:
            length += 1
            pass
        else:
            idx = i
            break
else:
    print(S[0])
    sys.exit()

if len(S) == length:
    print(1)
else:
    if K-1 < idx:
        print(1)
    else:
        print(S[idx])


Measured memory_bytes: 3060
#include <cstdio>
#include <cmath>
#include <vector>
using namespace std;
const double EPS = 1e-10;
bool equals(double a, double b) {
	return fabs(a - b) < EPS;
}
struct Point {
	double x, y;
	Point(double x = 0, double y = 0) :x(x), y(y) {}
	Point operator + (Point& rhs) {
		return Point(x + rhs.x, y + rhs.y);
	}
	Point operator - (Point& rhs) {
		return Point(x - rhs.x, y - rhs.y);
	}
	Point operator * (double k) {
		return Point(k * x, k * y);
	}
	bool operator < (const Point& rhs) const {
		return x != rhs.x ? x < rhs.x : y < rhs.y;
	}
	bool operator == (const Point& rhs) const {
		return equals(x, rhs.x) && equals(y, rhs.y);
	}
	double norm() {
		return x * x + y * y;
	}
	double abs() {
		return sqrt(norm());
	}
};
typedef Point Vector;
struct Segment {
	Point p1, p2;
	Segment(Point p1 = Point(), Point p2 = Point()) :p1(p1), p2(p2) {}
};
typedef Segment Line;
struct Circle {
	Point c;
	double r;
	Circle(Point c = Point(), double r = 0) :c(c), r(r) {}
};
typedef vector<Point> Polygon;
double dot(Vector a, Vector b) {
	return a.x * b.x + a.y * b.y;
}
double cross(Vector a, Vector b) {
	return a.x * b.y - a.y * b.x;
}
bool isOrthogonal(Vector a, Vector b) {
	return equals(dot(a, b), 0);
}
bool isOrthogonal(Segment a, Segment b) {
	return isOrthogonal(Vector(a.p2.x - a.p1.x, a.p2.y - a.p1.y), Vector(b.p2.x - b.p1.x, b.p2.y - b.p1.y));
}
bool isParallel(Vector a, Vector b) {
	return equals(cross(a, b), 0);
}
bool isParallel(Segment a, Segment b) {
	return isParallel(Vector(a.p2.x - a.p1.x, a.p2.y - a.p1.y), Vector(b.p2.x - b.p1.x, b.p2.y - b.p1.y));
}
int main() {
    int q;
    scanf("%d", &q);
    while(q--) {
    	double x0, y0, x1, y1;
    	scanf("%lf%lf%lf%lf", &x0, &y0, &x1, &y1);
    	Segment t1 = Segment(Point(x0, y0), Point(x1, y1));
    	scanf("%lf%lf%lf%lf", &x0, &y0, &x1, &y1);
    	Segment t2 = Segment(Point(x0, y0), Point(x1, y1));
    	if (isParallel(t1, t2)) printf("2\n");
    	else if (isOrthogonal(t1, t2)) printf("1\n");
    	else printf("0\n");
	}
	return 0;
}


Measured memory_bytes: 2760
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=100000000000000000;

ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}

int main(){
    ll n;cin>>n;
    ll a[2][n];
    ll sum[2][n];
    for(ll i=0;i<2;i++){
        for(ll j=0;j<n;j++){
            cin>>a[i][j];
            if(j==0){
                sum[i][j]=a[i][j];
            }else{
                sum[i][j]=sum[i][j-1]+a[i][j];
            }
        }
    }
    ll ans=-1;
    for(ll i=0;i<n;i++){
        if(i==0){
            ans=max(ans,sum[0][0]+sum[1][n-1]);
        }else{
            ans=max(ans,sum[0][i]+sum[1][n-1]-sum[1][i-1]);
        }
    }
    cout<<ans<<endl;
    return 0;
}



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

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

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

  vi x(n), y(n);
  vector<pii> p;
  rep(i, n){
    cin>>x[i]>>y[i];
    p.pb(mp(x[i],y[i]));
    dump(x[i],y[i]);
    dump(atan2(y[i], x[i]));
  }
  sort(all(p), [&](auto &left, auto &right)
      {return atan2(left.second, left.first) < atan2(right.second, right.first);}
      );
  dump(p);

  double ans = 0;
  rep(s, n){
    rep(leng, 1, n+1){
      dump(s, leng);
      int cur = s;
      int X = 0;
      int Y = 0;
      rep(_, leng){
        X += p[cur%n].first;
        Y += p[cur%n].second;
        dump(X, Y, sqrt(X*X+Y*Y));
        cur++;
      }
      chmax(ans, sqrt(X*X+Y*Y));
    }
  }
  printf("%.12f", ans);

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 512
import sys
read = sys.stdin.readline
import time
from heapq import heappush, heappop, heapify
import math
import itertools as it
from collections import deque 


def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
start_time = time.perf_counter()
# ------------------------------


mod = 10**9 + 7

N = inp()
A = inpl()
wa = 0
sm = A[0]
for i in range(1, N):
    wa = (wa + sm * A[i]) % mod
    sm = (sm + A[i]) % mod
print(wa)

# -----------------------------
end_time = time.perf_counter()
print('time:', end_time-start_time, file=sys.stderr)



Measured memory_bytes: 33404
#include <iostream>
#include <cstdlib>
#include <unordered_map>
#include<algorithm>
using namespace std;

int main()
{   
    long long N, sum;
    string S;
    sum = 0;
    
    cin >> N;
    unordered_map<std::string, int> hash;
    for(int i=0; i<N; i++){
        cin >> S;
        if(!hash[S]){
            sum++;
        }
        hash[S] = 1;
    }
    
    std::cout << sum << std::endl;

    return 0;
}


Measured memory_bytes: 17676
#include <bits/stdc++.h>
#include <map>
using namespace std;
int main(void){
   int N;
   cin >> N;
   vector<int> a(N);
   for(int i = 0; i < N; i++) cin >> a[i];
   sort(a.begin(),a.end());
   int C,CMax;
   C = CMax = 0;
   map<int,int> mp;
   for(int i = 0; i < N; i++){
       if(mp.count(a[i])) mp.at(a[i])++;
       else mp[a[i]] = 1;
   }
   for(int i = a[0]; i <= a[N-1]; i++){
       C += mp[i] + mp[i-1] + mp[i+1];
       CMax = max(C,CMax);
       C = 0;
    }
   cout << CMax << endl;
}

Measured memory_bytes: 5376
import sys
input = sys.stdin.readline

R, G, B, N = map(int, input().split())

r = N // R

c = 0
for i in range(r + 1):
    p = N - i * R
    for j in range(int(p // G) + 1):
        t = p - j * G
        if t == 0:
            c += 1
            break
            
        if t % B == 0:
            c += 1
                
print(c)

Measured memory_bytes: 40556
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
typedef vector<int> vi;
typedef vector<ll> vl;
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
ll com(ll n,ll r){
    ll x=1,y=1;
    ll tmp=n;
    while(tmp>=n-r+1){
        x=x*tmp%mod;
        tmp--;
    }
    while(r>0){
        y=y*r%mod;
        r--;
    }
    return x*rep_jijo(y,mod-2)%mod;
}

int main (){
    string s;
    cin >> s;
    bool flag=false;
    if(s[0]=='7') flag=true;
    if(s[1]=='7') flag=true;
    if(s[2]=='7') flag=true;
    if(flag) cout << "Yes" <<endl;
    else cout << "No" <<endl;

    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<string>
#include <iomanip>
#include<math.h>
using namespace std;
typedef long long ll;

int main() {
	ll n, k, i, j, t,u, h[333], dp[301][301][2],ndp[301][301][2],p,ans=1e15;
	cin >> n >> k;
	for (i = 0; i < n; i++)
		cin >> h[i];
	h[n] = 0;
		for (j = 0; j <= k; j++)
			for (t = 0; t <= n; t++)
				for (u = 0; u < 2; u++)
					dp[j][t][u] = -1;
	dp[0][n][0] = 0;
	for (i = 0; i < n; i++) {
		for (j = 0; j <= k; j++) {
			for (t = 0; t <= n; t++) {
				for (u = 0; u < 2; u++) {
					ndp[j][t][u] = -1;
				}
			}
		}
		for (j = 0; j <= k; j++) {
			for (t = 0; t <= n; t++) {
				for (u = 0; u < 2; u++) {
					if (dp[j][t][u] >= 0) {
						if (h[i] > h[t]) {
							p = dp[j][t][u] + h[i]-h[t];
							if (ndp[j][i][1] == -1)
								ndp[j][i][1] = p;
							else
								ndp[j][i][1] = min(ndp[j][i][1], p);
							p = dp[j][t][u];
							if (j < k) {
								if (ndp[j+1][t][0] == -1)
									ndp[j+1][t][0] = p;
								else
									ndp[j+1][t][0] = min(ndp[j+1][t][0], p);
							}
						}
						else {
							p = dp[j][t][u];
							if (ndp[j][i][0] == -1)
								ndp[j][i][0] = p;
							else
								ndp[j][i][0] = min(ndp[j][i][0], p);
							p = dp[j][t][u];
							if (j < k) {
								if (ndp[j + 1][t][0] == -1)
									ndp[j + 1][t][0] = p;
								else
									ndp[j + 1][t][0] = min(ndp[j + 1][t][0], p);
							}
						}
					}
				}
			}
		}
		for (j = 0; j <= k; j++) {
			for (t = 0; t <= n; t++) {
				for (u = 0; u < 2; u++) {
					dp[j][t][u] = ndp[j][t][u];
				}
			}
		}
	}
	for (j = 0; j <= k; j++)
		for (t = 0; t <= n; t++)
			for (u = 0; u < 2; u++)
				if(dp[j][t][u]>=0)
					ans = min(ans, dp[j][t][u]);
	cout << ans << endl;
}


Measured memory_bytes: 3072
#include<bits/stdc++.h> 
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define unmap unordered_map < int, int > 
#define unset unordered_set < int > 
#define maxpq priority_queue < int > 
#define minpq priority_queue < int, vector < int > , greater < int >> 
#define sort(v) sort(v.begin(), v.end());
#define sortd(v) sort(v.begin(), v.end(), greater < int > ());
#define pb push_back
#define ll long long
#define ff first# define ss second //typedef second ss;
#define foton(i, n) for (int i = 0; i < n; i++)
#define faton(i, a, n) for (int i = a; i <= n; i++)
#define mod 1000000007
#define endl "\n"
using namespace std;

void solve() {

}

int main() {
    fastio;
    string a,b;
    cin>>a>>b;
    int n,m;
    n = a.size();
    m = b.size();
    int ans = m;
    for(int i=0;i+m<=n;i++){
        int cnt = 0;
        for(int j = 0;j<m;j++){
            if(b[j] != a[i+j]) cnt++;
        }
        ans = min(cnt,ans);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3664