akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <unordered_map>
#include <algorithm>
#include <numeric>

int main() {
    int n;
    long m;
    scanf("%d %ld", &n, &m);
    long b[n+1];
    b[0] = 0;
    for (long i = 1; i <= n; i++) {
        scanf(" %ld", b+i);
        b[i] += b[i - 1];
        b[i] %= m;
    }
    std::unordered_map<long, long> mp;
    for (long s : b) {
        mp[s]++;
    }
    long long ss[mp.size()];
    std::transform(mp.begin(), mp.end(), ss, [](auto p) -> long long {return (p.second - 1) * p.second / 2;});
    long long ans = 0;
    for (long i: ss) {
        ans += i;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 4516
s = input()
flag = 0
index_A = 0
index_Z = 0
for i in range(len(s)):
    if s[i]=='A' and flag == 0:
        index_A = i
        flag = 1
    if s[i]=='Z':
        index_Z = i
ans = index_Z - index_A + 1
print(ans)

Measured memory_bytes: 3516
O = ["+","-"]
I = list(input())
for o1 in O :
    for o2 in O :
        for o3 in O :
            f = I[0]+o1+I[1]+o2+I[2]+o3+I[3]
            if eval(f) == 7 :
                print(f+"=7")
                exit()
            
            

Measured memory_bytes: 3060
#include<bits/stdc++.h>
//#include<atcoder/all>
using namespace std;
//using namespace atcoder;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
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; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const ll MOD=1000000007;
const ll LINF=1ll<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};





int main(){
    int n;cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    ll now = 1000, t = 0;
    for (int i = 1; i < n; i++) {
        if(a[i - 1] < a[i]){
            t = now / a[i - 1];
            now += (a[i] - a[i - 1]) * t;
        }
    }
    cout << now << endl;
    return 0;
}




Measured memory_bytes: 3552
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N;
  	cin >> N;
  	int A[N+1],B[N+1];
  
  	for(int i=1; i<=N; i++){
      cin >> A[i];
      B[A[i]] = i;
    }

  	for(int i=1; i<=N; i++){
      cout << B[i] << " ";
    }
}


Measured memory_bytes: 1536
n = list(map(int,input().split()))
ans = 0
if (n[2] - n[1]) % 2 == 0:
  ans = (n[2] - n[1]) // 2
else:
  ans = min(n[0] - n[2] + 1, n[1] - 1 + 1)
  ans += abs(n[2] - n[1] - 1) // 2

print(ans)

Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

ll solve(ll n, ll c, ll d) {
  ll ret = n;
  ll other = (c*d) / __gcd(c, d);
  ret -= n / c;
  ret -= n / d;
  ret += n / other;
  return ret;
}

void solve() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << solve(b, c, d) - solve(a-1, c, d) << "\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  /*
  ll t;
  cin >> t;
  for(ll i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
}


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

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

  int p[N];
  for (int i = 0; i < N; i++) {
    cin >> p[i];
  }

  sort(p, p + N);

  int sum = 0;
  for (int i = 0; i < N; i++) {
    if (i == N -1) {
      sum += p[i] / 2;
    } else {
      sum += p[i];
    }
  }

  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,m,p; cin>>n>>m;
  string s;
  vector<int> ac(n,0);
  vector<int> wa(n,0);
  int sumAC=0,sumWA=0;
  for(;m--;){
    cin>>p>>s;
    p--;
    if(s=="AC") ac[p]=1;
    else if(s=="WA"&&!ac[p]) wa[p]++;
  }
  for(int i=0;i<n;i++){
    sumAC+=ac[i];
    if(ac[i]) sumWA+=wa[i];
  }
  cout<<sumAC<<" "<<sumWA;
}

Measured memory_bytes: 4052
import java.util.*;
import java.io.*; 
import java.math.BigInteger;
import java.text.*;

public class Main{
    long mod = (int)1e9+7, IINF = (long)1e18;
    final int MAX = (int)1e4+1, INF = (int)1e9, root = 3;
    DecimalFormat df = new DecimalFormat("0.00000000");
    double PI = 3.141592653589793238462643383279502884197169399375105820974944;
    static boolean multipleTC = false, memory = false;
    FastReader in;PrintWriter out;
    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();
        else new Main().run();
    }

    void run() throws Exception{
        in = new FastReader();
        out = new PrintWriter(System.out);
        for(int i = 1, T= (multipleTC)?ni():1; i<= T; i++)solve(i);
        out.flush();
        out.close();
    }
    
    void solve(int TC) throws Exception{
        int a = ni(), b = ni();
        pn(a*b-a-b+1);
    }
    
    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}
    void p(Object o){out.print(o);}
    void pn(Object o){out.println(o);}
    void pni(Object o){out.println(o);out.flush();}
    String n(){return in.next();}
    String nln(){return in.nextLine();}
    int ni(){return Integer.parseInt(in.next());}
    long nl(){return Long.parseLong(in.next());}
    double nd(){return Double.parseDouble(in.next());}

    class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next(){
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine(){
            String str = "";
            try{    
                str = br.readLine();
            }catch (IOException e){
                e.printStackTrace();
            }   
            return str;
        }
    }
}   

Measured memory_bytes: 20820
#include <bits/stdc++.h>
using namespace std;
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; }
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

ll x, y;

void input(){
    cin >> x >> y;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    ll ans = INF;
    ll tmp = 0;
    ll xx = x;
    ll yy = y;
    for(int i=0;i<2;i++){
        for(int j=0;j<2;j++){
            if(i){
                xx = -xx;
                tmp++;
            }
            if(j){
                yy = -yy;
                tmp++;
            }
            if(xx <= yy){
                tmp += yy-xx;
            }
            else{
                tmp = 0;
                xx = x;
                yy = y;
                continue;
            }
            ans = min(ans, tmp);
            tmp = 0;
            xx = x;
            yy = y;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import numpy as np
N = int(input())
dp = [[0, 0, 0] for i in range(N+1)]
for i in range(1, N+1):
    a, b, c = list(map(int, input().split(' ')))
    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a
    dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c
print(np.max(dp[-1]))

Measured memory_bytes: 31732
use proconio::{input, fastout};
use proconio::marker::{Chars};
#[fastout]
fn main() {
    input!{
        _s: Chars,
    }

    let s: String = _s.iter().collect();
    let y = &s[0..4];
    let year: usize = y.parse().unwrap();
    let m = &s[5..7];
    let month: usize = m.parse().unwrap();
    // let d = &s[8..10];
    // let day = d.parse().unwrap();

    if year < 2019 {
        println!("Heisei");
        return;
    } else {
        if month <= 4 {
            println!("Heisei");
            return;
        } else {
            println!("TBD");
        }
    }

}


Measured memory_bytes: 2168
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.nextInt()
    val b = sc.nextInt()
    val c = sc.nextInt()
    println(problem066a(a, b, c))
}

fun problem066a(a: Int, b: Int, c: Int): Int {
    return listOf(a, b, c).sorted().take(2).sum()
}

Measured memory_bytes: 35912
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=1000010;
const ll mod=1e9+7;


int main(){
  map<int,int> mp;
  rep(i,6){
    int a;
    cin >> a;
    mp[a]++;
    if(mp[a]==3){
      cout << "NO" << endl; return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}

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

using namespace std;

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

#define int ll


main(){
	ll n,k;
	cin >> n >> k;

	int ans = 1;
	ll tmp = k;
	while(n>=tmp){
		ans++;
		tmp*=k;
	}

	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int64_t mod=1e9+7;
int64_t pw(int64_t x,int64_t y){
  int z;
  if(y==0) return 1;
  else{
    z=pw(x,y/2)*pw(x,y/2)%mod;
    if(y%2==1) z=z*x%mod;
    return z;
  }
}
int64_t comb(int64_t x,int64_t y){
  int64_t z=1,i;
  for(i=1;i<=y;i++){
    z=z*(x-i+1)%mod;
    z=z*pw(i,mod-2)%mod;
  }
  return z;
}
int main(){
  int64_t n,m,k,l,i,ans=1;
  cin>>n>>m;
  vector<int64_t> x;
  k=m;
  for(i=2;i*i<=m;i++){
    l=0;
    while(k%i==0){
      k/=i;
      l++;
    }
    if(l>0) x.push_back(l);
  }
  if(k>1) x.push_back(1);
  for(auto z:x) ans=ans*comb(n+z-1,z)%mod;
  cout<<ans<<endl;
}

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

int main() {
  int a,b,c;
  bool ans = false;
  cin >> a >> b >> c;
  for(int i = 1; i <= b; i++){
    if((a * i) % b == c){
      ans = true;
      break;
    }
  }
  if(ans){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <stdio.h>
#include <cmath>
#include <limits.h>
using namespace std;

typedef long long ll;

#define min(a, b) (((a) < (b))? (a):(b))
#define max(a, b) (((a) > (b))? (a):(b))
#define REP(i, a, n) for(int i=(a); i<(n); ++i)
#define rep(i, n) REP(i, 0, (n))
#define square(a) (a)*(a)
#define pb push_back


int main(void) {
    
    int n,k;
    cin >> n >> k ;
    int x[110];
    rep(i,n) cin >> x[i];
    
    int ans = 0;
    rep(i,n){
        if(x[i]<(k-x[i]))   ans += 2*x[i];
        if((k-x[i])<=x[i])     ans += 2*(k-x[i]);
    }
    cout << ans << endl;
}

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

using namespace std;


int main(){
    int n, a[20], b[20], c[20];
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    for(int i=0; i<n; i++){
        cin >> b[i];
    }
    for(int i=0; i<n-1; i++){
        cin >> c[i];
    }

    int sum = 0;
    for(int i=0; i<n; i++){
        sum += b[a[i]-1]; // b
        if(i == 0){
            continue;
        }
        if(a[i-1] + 1 == a[i]) {
            sum += c[a[i-1]-1]; // c
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace Print_Test_Cases
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i=1 ; ; i++)
            {
                int x = int.Parse(Console.ReadLine());
                if (x == 0)
                    break;
                else
                    Console.WriteLine("Case " + i + ": " + x);
            }
        }
    }
}

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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
#define test cout<<"test"<<endl;
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
const ll zero=0;
using P = pair<ll, ll>;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  bool judge = true;
  ll n,p;cin>>n>>p;
  vector<ll>a(n);
  for(i=0;i<n;i++){
    cin>>a[i];
  }
  ll dp[n+1][2];
  dp[0][0]=1;dp[0][1]=0;
  for(i=0;i<n;i++){
    if(a[i]%2==1){
      dp[i+1][0]=dp[i][0]+dp[i][1];
      dp[i+1][1]=dp[i][0]+dp[i][1];
    }
    else{
      dp[i+1][0]=dp[i][0]*2;
      dp[i+1][1]=dp[i][1]*2;
    }
  }
  cout<<dp[n][p]<<endl;

  return 0;
}

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

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;

//Nの桁数
int digits(int N)
{
    int d = 1;
    while (N /= 10) d++;
    return d;
}

int dfs(int N, int sum, int pos, bool three, bool five, bool seven)
{
    if (pos == 0) return (three && five && seven && sum <= N) ? 1 : 0;

    int r0 = dfs(N, sum, 0, three, five, seven); //打ち切り
    int r1 = dfs(N, sum * 10 + 3, pos - 1, true, five, seven); // pos桁目に3
    int r2 = dfs(N, sum * 10 + 5, pos - 1, three, true, seven); // pos桁目に5
    int r3 = dfs(N, sum * 10 + 7, pos - 1, three, five, true); // pos桁目に7
    return r0 + r1 + r2 + r3;
}

int main()
{
    int N; cin >> N;
    cout << dfs(N, 0, digits(N), false, false, false) << endl;
    return 0;
}


Measured memory_bytes: 256
/////////////////////////   _LeMur_
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cassert>
#include <bitset>
#include <cstdio>
#include <vector>
#include <string>
#include <ctime>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <list>
#include <map>
#include <set>

using namespace std;

const int N = 4005;
const int inf = 1000 * 1000 * 1000;
const int mod = 998244353;

string s;
int dp[N][N];

int sz[N][2];

int main(){
    cin>>s;
    for(int i=0;i<(int)s.size();i++){
        sz[i + 1][0] = sz[i][0];
        sz[i + 1][1] = sz[i][1];
        ///
        int x = s[i] - '0';
        if(x == 0) sz[i + 1][0] += 2;
        if(x == 1){
            sz[i + 1][0]++;
            sz[i + 1][1]++;
        }
        if(x == 2) sz[i + 1][1] += 2;
    }
    int n = (int)s.size();
    for(int i=n+1;i<=2*n;i++){
        sz[i][0] = sz[n][0];
        sz[i][1] = sz[n][1];
    }
    dp[0][0] = 1;
    for(int i=1;i<=2*n;i++){
        for(int j=0;j<i;j++){
            if(dp[i - 1][j] == 0)continue;
            if(sz[i][0] - j > 0){
                dp[i][j + 1] += dp[i - 1][j];
                dp[i][j + 1] %= mod;
            }
            if(sz[i][1] - (i - 1 - j) > 0){
                dp[i][j] += dp[i - 1][j];
                dp[i][j] %= mod;
            }
        }
    }
    int answ = 0;
    for(int i=0;i<=2*n;i++){
        answ += dp[2*n][i];
        answ %= mod;
    }
    cout<<answ<<endl;
    return 0;
}


Measured memory_bytes: 60544
s = input()
acgt = [0]
tmp = 0
for i in range(len(s)):
  if s[i] in ['A', 'C', 'G', 'T']:
    tmp += 1
  elif tmp > 0:
    acgt.append(tmp)
    tmp = 0

acgt.append(tmp)

print(max(acgt))

Measured memory_bytes: 8900
Program ABC123A

integer a,b,c,d,e,k,p(10)

read(*,*) a,b,c,d,e,k

p(1)=b-a
p(2)=c-a
p(3)=d-a
p(4)=e-a
p(5)=c-b
p(6)=d-b
p(7)=e-b
p(8)=d-c
p(9)=d-c
p(10)=e-d

do i=1,10
 if (p(i)>k) then
  write(*,*) ':('
  go to 10
 end if
end do

write(*,*) 'Yay!'

10 stop
end

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    template<typename T>
    vector<T> read_vec(size_t n){
        vector<T> tmp(n);
        for(size_t i = 0; i < n; i++){
            cin >> tmp[i];
        }
        return tmp;
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

void add(pair<ll, ll>& p, pair<ll, ll> q){
    p.first += q.first;
    p.second += q.second;
}

ll inp(pair<ll, ll> p, pair<ll, ll> q){
    return p.first * q.first + p.second * q.second;
}

ll oup(pair<ll, ll> p, pair<ll, ll> q){
    return p.first * q.second - p.second * q.first;
}

int main(){
    Stream io;
    
    int N;
    io.read(N);
    vector<pair<ll, ll>> p;
    for(int i = 0; i < N; i++){
        ll x, y;
        io.read(x, y);
        if(x == 0 && y == 0) continue;
        p.push_back(make_pair(x, y));
    }
    sort(p.begin(), p.end(), [](const auto& a, const auto& b){
        ll o = oup(a, b);
        ll i = inp(a, b);
        pair<ll, ll> stnd = make_pair(1LL, 0LL);
        if(o == 0) {
            if(i > 0) { 
                return false;
            }
            if(oup(stnd, a) > 0) {
                return true;
            }
            if(a.first > 0 && a.second == 0){
                return true;
            }
            return false;
        }
        if(o > 0){
            return !(oup(a, stnd) > 0 && oup(stnd, b) >= 0);
        }
        return (oup(b, stnd) > 0 && oup(stnd, a) >= 0);
    });
    ll ans = 0;
    for(int i = 0; i < p.size(); i++){
        for(int j = 0; j < p.size(); j++){
            pair<ll, ll> sum = make_pair(0L, 0L);
            if(i > j){
                for(int k = i; k < p.size(); k++){
                    add(sum, p[k]);
                }
                for(int k = 0; k <= j; k++){
                    add(sum, p[k]);
                }
            }
            else{
                for(int k = i; k <= j; k++){
                    add(sum, p[k]);
                }
            }
            ans = max(ans, inp(sum, sum));
        }
    }
    cout << fixed << setprecision(10) << sqrt(ans);
    return 0;
}

Measured memory_bytes: 256
house = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n=int(input())
for x in range(n):
    a,b,c,d=map(int,input().split())
    house[a-1][b-1][c-1]+=d
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(f' {house[i][j][k]}',end="")
        print()
    if int(i)<3: print("#"*20)



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

class Program
{
	static void Main(string[] args)
	{
		var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
		var a = input[0];
		var b = input[1];
		var c = input[2];

		var ans = 0;
		for (var i = a; i <= b; i++)
		{
			if (c % i == 0)
			{
				ans++;
			}
		}

		System.Console.WriteLine(ans);
	}
}


Measured memory_bytes: 18444
#include <iostream>

int main() {
        int r;
        std::cin >> r;

        if (r <1200) {
                std::cout << "ABC" << std::endl;
        }
        else if (r < 2800) {
                std::cout << "ARC" << std::endl;
        }
        else {
                std::cout << "AGC" << std::endl;
        }
        return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	@SuppressWarnings("unused")
	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt(); // 県の個数
		int m = in.nextInt(); // 市の個数

		// 県、年でソート
		PriorityQueue<City> city = new PriorityQueue<>(m, new Comparator<City>() {
			@Override
			public int compare(City o1, City o2) {
				if ( o1.pref != o2.pref ) {		// 県でソート
					return o1.pref - o2.pref;
				} else {						// 同じ県の時は年でソート
					return o1.year - o2.year;
				}
			}
		});
		for ( int id = 1; id <= m; id++ ) {
			city.add(new City(id, in.nextInt(), in.nextInt()));
		}

		// 県ごとに年でナンバー付けしてidでソート
		String citycode[] = new String[m + 1];
		int p = 0;
		int num = 0;
		DecimalFormat df = new DecimalFormat("000000");
		while ( city.size() > 0 ) {
			City c = city.poll();
			// 新出の県の場合
			if ( p != c.pref ) {
				p = c.pref;
				num = 1;
			} else {
				num++;
			}
			citycode[c.id] = df.format(p) + df.format(num);
			// System.out.println("id:" + c.id + " pref:" + c.pref + " year:" + c.year);
		}

		PrintWriter pw = new PrintWriter(System.out);
		for ( int i = 1; i <= m; i++ ) {
			pw.println(citycode[i]);
		}
		pw.flush();
		in.close();
	}
}

class City {

	int	id		= 0;
	int	pref	= 0;
	int	year	= 0;

	public City(int id, int pref, int year) {
		this.id = id;
		this.pref = pref;
		this.year = year;
	}
}


Measured memory_bytes: 99144
def manhattan_distance(s, c):
    return abs(s[0] - c[0]) + abs(s[1] - c[1])


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

students = [list(map(int, input().split())) for _ in range(N)]
checkpoints = [list(map(int, input().split())) for _ in range(M)]

for s in students:
    ans = 0
    min_distance = manhattan_distance(s, checkpoints[0])
    for i in range(1, M):
        distance = manhattan_distance(s, checkpoints[i])
        if min_distance > distance:
            min_distance = distance
            ans = i
    print(ans + 1)


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

#define ll long long
#define int long long
#define loop(i,s,e) for(int i=s;i<e;i++)
#define rloop(i,s,e) for(int i=e;i>=s;i--)
#define fr first
#define sc second
#define pb push_back
#define  vii vector<int>
#define vll vector<ll>
#define vpii vector<pair<int ,int >>
#define vpll vector<pair<ll, ll> >
#define  pii pair<int,int>
#define lb(v,x) lower_bound(v.begin(),v.end(),x);
#define ub(v,x) upper_bound(v.begin(),v.end(),x);
const long mod =1e8;
const int N = 5e6+5;
const long long inf= 1e18;

ll gcd(ll a ,ll b){if(b==0) return a;return gcd(b,a%b);}
ll mul(ll a ,ll b){return (a%mod * b%mod )%mod;}
ll mpower(ll a, ll b){if(b==0) return 1;ll temp=mpower(a,b/2);if(b%2==0){return mul(temp,temp);}else{	return mul(mul(temp,temp) , a);}}
ll inv(ll a){return mpower(a,mod-2);}
ll ncr(ll n, ll r){if(r==0)return 1;ll ans=n%mod;ans=mul(ans,ncr(n-1,r-1));ans=mul(ans,inv(r));	return ans;}
ll power(ll a, ll b){if(b==0) return 1;ll temp=power(a,b/2);if(b%2==0)return temp*temp;else return temp*temp*a;}
ll add(ll a, ll b){return (a%mod + b%mod)%mod;}



void solve()
{
    ll k,a,b;
    cin>>k>>a>>b;
    int f=0;
    for(int i=a;i<=b;i++)
    {
        if(i%k==0)
        {
            f=1;
        }
    }
    if(f)cout<<"OK";
    else cout<<"NG";
}

int32_t main()
{
	ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1;//cin>>t;
	while(t--){
        solve();
	}
}

Measured memory_bytes: 3664
#include <stdio.h>
int main(){
  int i,j,A[100],change,N,s,k,flag=0;
  scanf("%d",&N);
  for(i=0;i < N;i++){
    scanf("%d",&A[i]);
  }
  for(i=0; i < N-1;i++){

    s=i;
    k=i;
    for(j=i+1; j < N ;j++){
      if(A[k] > A[j]){

        k =j;
}
    }
    if(s!=k){
      change=A[i];
      A[i]=A[k];
      A[k]=change;
      flag++;
    }
  }
  for(j=0;j < N ;j++){
    if(j==N-1){
      printf("%d",A[j]);
    }
    else{
      printf("%d ",A[j]);
    }
  }
  printf("\n");
  printf("%d\n",flag);
  return 0;
}



Measured memory_bytes: 2088
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;

	static void solve() {
		int n = ir.nextInt();
		int k = ir.nextInt();
		out.println(k == 1 ? 0 : n - k);
	}

	public static void main(String[] args) {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}

	static void tr(Object... o) {
		out.println(Arrays.deepToString(o));
	}
}


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

using ll=long long;

int n, p;
ll mod[2];
ll c[55][55];
ll poww[55];
ll ans;
int x;

void Solve()
{
	cin>>n>>p;
    for (int i = 0; i < n; ++i) 
	{
		cin>>x;
		++mod[x&1];
    }
    for (int i = p; i <= mod[1]; i += 2)
            ans += c[mod[1]][i] * poww[mod[0]];
    cout<<ans;
}

void Init()
{
	for (int i=0;i<=50;i++) c[i][0]=c[i][i]=1;
    for (int i = 1; i <= 50; ++i)
        for (int j = 0; j != i; ++j)
            c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
    poww[0] = 1;
    for (int i = 1; i <= 50; ++i) poww[i] = poww[i - 1] * 2;
}

int main() 
{

    Init();
    Solve();
    
    return 0;
}

Measured memory_bytes: 256
A,B,C,D = map(int,input().split())

if C%B == 0:
    t = C//B
else:
    t = C//B + 1
    
if A%D == 0:
    a = A//D
else:
    a = A//D + 1

    
if t > a:
    print('No')
elif t < a:
    print('Yes')
elif t == a:
    print('Yes')


Measured memory_bytes: 9180
#include <vector>
#include <iostream>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> P(N);
	for (int i = 0; i < N; ++i) cin >> P[i], --P[i];
	vector<int> IP(N);
	for (int i = 0; i < N; ++i) IP[P[i]] = i;
	int cont = 0, ans = 0;
	for (int i = 0; i < N; ++i) {
		if (i != 0 && IP[i] < IP[i - 1]) {
			cont = 0;
		}
		++cont;
		ans = (ans > cont ? ans : cont);
	}
	cout << N - ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define all(n) n.begin(),n.end()
#define yn(x) cout << (x ? "Yes":"No") << endl;

int main() {
  ll n;
  cin >> n;
  vector<ll>l(n);
  rep(i,n) cin >> l[i];
  sort(all(l));
  reverse(all(l));
  ll ans = 0;
  rep(i,n) for(ll j=i+1;j<n;j++) for(ll k=j+1;k<n;k++){
    if(l[i]<l[j]+l[k]) ans++;
  }
  cout << ans << endl;
  return 0;
}


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

int getFive(int x_num) {
    return (x_num == 5? 1 : 0);
}

int getSeven(int x_num) {
    return (x_num == 7? 1 : 0);
}

int main(void){
    int a, b, c, cnt5 = 0, cnt7 = 0;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> a >> b >> c;

    cnt5 = getFive(a) + getFive(b) + getFive(c);
    cnt7 = getSeven(a) + getSeven(b) + getSeven(c);

    cout << (cnt5 == 2 && cnt7 == 1? "YES" : "NO") << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int x, y;
	
	while (1) {
		cin >> x >> y;

		if ((x == 0) && (y == 0))break;

		if (x < y){
			cout << x << " " << y << endl;
		}
		if (x > y){
			cout << y << " " << x << endl;
		}
		if (x == y){
			cout << x << " " << y << endl;
		}
	}



	return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

ll gcd(ll a, ll 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 mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

void solve(long long N, std::vector<long long> A)
{
    map<ll,ll> cnt;
    ll tmp = 0;
    ll ans = 0;
    for (int i = 0; i < N; i++)
    {
        tmp += A[i];
        cnt[tmp]++;

        if(tmp == 0){
            ans++;
        }

        ans += cnt[tmp]-1;
    }

    cout << ans << endl;
    
}

int main()
{
    long long N;
    scanf("%lld", &N);
    std::vector<long long> A(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 14336
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var HW = Sarray();
            var H = HW[0];
            var W = HW[1];
            var ban = new char[H + 2][];
            ban[0] = new string('#', (int)W + 2).ToArray();
            for (var i = 1; i <= H; ++i)
                ban[i] = ("#" + ReadLine() + "#").ToArray();
            ban[H + 1] = ban[0];
            var q = new Queue<Tuple<long, long, long>>();//深さ、H,W
            for (var h = 1L; h <= H; ++h)
            {
                for (var w = 1L; w <= W; ++w)
                {
                    if (ban[h][w] == '#')
                        q.Enqueue(Tuple.Create(0L, h, w));
                }
            }
            var maxD = 0L;
            var dh = new long[] { 0, 1, -1, 0 };
            var dw = new long[] { -1, 0, 0, 1 };
            while(q.Any())
            {
                var dq = q.Dequeue();
                var d = dq.Item1;
                var h = dq.Item2;
                var w = dq.Item3;
                for (var i = 0; i < 4; ++i)
                {
                    var nh = h + dh[i];
                    var nw = w + dw[i];
                    var nd = d + 1;
                    if (ban[nh][nw] == '.')
                    {
                        maxD = Max(maxD, nd);
                        q.Enqueue(Tuple.Create(d + 1, nh, nw));
                        ban[nh][nw] = '#';
                    }
                }
            }
            WriteLine(maxD);
            //Out.Flush();
        }
    }
}

Measured memory_bytes: 67956
#include <iomanip>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  __int128 answer = 1;
  const __int128 limit = 1e18L;
  bool of = false;
  bool zf = false;
  rep(i, N) {
    int64_t a;
    cin >> a;
    answer *= (__int128)a;
    // cout << answer << endl;
    if (a == 0) zf = true;
    if (answer > limit) of = true;
  }
  if (zf)
    answer = 0;
  else if (of)
    answer = -1;
  cout << (int64_t)answer << endl;
  return 0;
}


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

pair<long, long> a[222222];
long d[222222], e[222222];
int main() {
    int n, T;
    cin >> n >> T;
    for(int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        a[i] = {x, y};
    }
    sort(a, a + n, [](auto x, auto y) {
        if(y.first * (x.second + 1) == x.first * (y.second + 1))
            return x.second < y.second;
        return y.first * (x.second + 1) < x.first * (y.second + 1);
    });
    int i = 0;
    fill(d + 1, d + n + 1, 1e18);
    for(; i < n; i++) {
        if(!a[i].first)
            break;
        int j;
        for(j = 0; j < n; j++)
            if(d[j] >= T)
                break;
        while(j--)
            d[j + 1] =
                min(d[j + 1], (a[i].first + 1) * (d[j] + 1) + a[i].second);
    }
    int I = n - i;
    for(i = 0; i < I; i++)
        e[i + 1] = e[i] + a[i + n - I].second + 1;
    int r = 0;
    for(int j = 0; j <= n; j++) {
        if(d[j] > T)
            continue;
        int x = upper_bound(e + 1, e + I + 1, T - d[j]) - e - 1;
        r = max(r, j + x);
    }
    cout << r << endl;
    return 0;
}


Measured memory_bytes: 6656
#include<bits/stdc++.h>
using namespace std;
int main()
{
  	int n;
  	cin >> n;
  	int a[n] , sum = 0 , ma = -1;
  	for(int i = 0 ; i < n ; i++)
    {  
      	cin >> a[i];
  		sum += a[i];
     	ma = max(ma , a[i]);
    }
  	sum -= ma;
  	sum += (ma/2);
  	cout << sum << endl;  
 	return 0; 
}

Measured memory_bytes: 256
#include <stdio.h>

int abs(int a)
{
  return (a < 0) ? -a : a;
}

int main(void)
{
  int w[110];
  int N, min, tmp;
  scanf("%d", &N);
  for(int i = 1; i <= N; i++)
  {
    scanf("%d", w + i);
    tmp += w[i];
  }
  
  min = tmp;
  
  for(int t = 1; t < N; t++)
  {
    tmp = 0;
    for(int i = 1; i <= t; i++)
    {
      tmp += w[i];
    }
    for(int i = t + 1; i <= N; i++)
    {
      tmp -= w[i];
    }
    tmp = abs(tmp);
    if(tmp < min)
    {
      min = tmp;
    }
  }
  
  printf("%d\n", min);
  
  return 0;
}

Measured memory_bytes: 128
import java.io.*;
import java.util.*;

public class Main {

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

		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> mt = new ArrayList<Integer>();
		int n = Integer.parseInt(sc.next());
		int count = 0;
		int max = 0;
		List<Integer> sbList;
		for(int i =0;i<n;i++) {
			mt.add(Integer.parseInt(sc.next()));
		}
		for(int j =0;j<n;j++) {
			if(j != 0) {

				sbList = mt.subList(0, j+1);
				max = Collections.max(sbList);

				if(max==mt.get(j)){
					count++;
				}
			}else {
				count++;
			}
		}
		System.out.println(count);
	}

}


Measured memory_bytes: 23124
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;
	static int[][] g;

	static int[][] undirectedGraph(int n, int[] v1, int[] v2) {
		int[] cnt = new int[n];
		for (int i : v1) cnt[i]++;
		for (int i : v2) cnt[i]++;

		int[][] g = new int[n][];
		for (int i=0; i<n; i++) g[i] = new int[cnt[i]];
		for (int i=0; i<v1.length; i++) {
			int s = v1[i];
			int t = v2[i];
			g[s][--cnt[s]] = t;
			g[t][--cnt[t]] = s;
		}

		return g;
	}

	static int n, k;

	static int dfs(int cur, int prev, int depth) {
		if (depth > k/2) return 0;
		int res = 0;
		for (int to : g[cur]) {
			if (to == prev) continue;

			res += dfs(to, cur, depth+1);
		}
		return res + 1;
	}

	static int dfs2(int cur, int prev, int depth, int x) {
		if (depth > k/2) return 0;
		int res = 0;
		for (int to : g[cur]) {
			if (to == prev || to == x) continue;

			res += dfs2(to, cur, depth+1, x);
		}
		return res + 1;
	}

	static void solve() {
		n = in.nextInt();
		k = in.nextInt();
		int[] s = new int[n-1];
		int[] t = new int[n-1];
		for (int i=0; i<n-1; i++) {
			s[i] = in.nextInt() - 1;
			t[i] = in.nextInt() - 1;
		}
		g = undirectedGraph(n, s, t);
		int ans = n;
		if (k%2 == 0) {
			for (int i=0; i<n; i++) {
				ans = Math.min(ans, n - dfs(i, -1, 0));
			}
		} else {
			for (int i=0; i<n-1; i++) {
				ans = Math.min(ans, n - dfs2(s[i], -1, 0, t[i]) - dfs2(t[i], -1, 0, s[i]));
			}
		}

		out.println(ans);
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();

		solve();
		out.flush();

		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

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

int F[102][102];
void DFS(int y, int x, int c){
  if(F[y][x]!=c){
    return;
  }

  F[y][x]=6;

  DFS(y, x+1, c);
  DFS(y, x-1, c);
  DFS(y+1, x, c);
  DFS(y-1, x, c);
}

int main(){
  while(1){
    for(int i=0; i<20; i++){
      for(int j=0; j<20; j++){
        F[i][j]=0;
      }
    }
    int w,h,xs,ys,xg,yg,n;
    cin >> w >> h;
    if(w==0&&h==0){
      return 0;
    }
    cin >> xs >> ys >> xg >> yg >> n;
    for(int i=0; i<n; i++){
      int a,b,x,y;
      cin >> a >> b >> x >> y;
      if(b==0){
        F[y][x]=a;
        F[y][x+1]=a;
        F[y][x+2]=a;
        F[y][x+3]=a;
        F[y+1][x]=a;
        F[y+1][x+1]=a;
        F[y+1][x+2]=a;
        F[y+1][x+3]=a;//横長
      }else{
        F[y][x]=a;
        F[y+1][x]=a;
        F[y+2][x]=a;
        F[y+3][x]=a;
        F[y][x+1]=a;
        F[y+1][x+1]=a;
        F[y+2][x+1]=a;
        F[y+3][x+1]=a;//縦長
      }
    }
    int z = F[ys][xs];
    if(z==0){
      cout << "NG" << endl;
      continue;
    }
    DFS(ys, xs , z);
    if(F[yg][xg]==6){
      cout << "OK" << endl;
    }else{
      cout << "NG" << endl;
    }
  }
}



Measured memory_bytes: 3008
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int i, j, tmp;
		int[] a = { 0, 0, 0 };
		Scanner s = new Scanner(System.in);

		for (i = 0; i < 3; i++)
			a[i] = s.nextInt();
		for (i = 0; i < 2; i++)
			for (j = i + 1; j < 3; j++)
				if (a[i] > a[j]) {
					tmp = a[i];
					a[i] = a[j];
					a[j] = tmp;
				}

		System.out.println(a[0] + " " + a[1] + " " + a[2]);
	}

}



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

using namespace std;

int main()
{
    long long a,b,n;
    cin>>n>>a>>b;
    if(n==1)
    {
        if(a==b)
        cout<<1;
        else
        cout<<0;
    }
    else 
    {
    if(a==b)
    cout<<1;
    else if(a>b)
    cout<<0;
    else
    cout<<((b-a)*(n-1))-(b-a-1);
    }
    return 0;
}

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

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

		try {
			while(true){
				String strs[] = br.readLine().split(" ");
				int a = Integer.parseInt(strs[0]);
				if(a == 0) return;
				int b = Integer.parseInt(strs[1]);
				int n = Integer.parseInt(strs[2]);
				int count = 0;
				
				int m = a;
				while(true){
					if(check(m)) count++;
					if(count == n){
						System.out.println(m);
						break;
					}
					m += b;
				}
			}
		} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
		}
	}
	
	public static boolean check(int m){
		if(m == 1) return false;
		for(int i = 2; i <= Math.sqrt(m); i++){
			if(m % i == 0) return false;
		}
		return true;
	}
	
	public static void printArray(int array[]){
		for(int i = 0; i < array.length; i++)
			System.out.print(array[i] + "\t");
		System.out.println();
	}

	public static void printArray(boolean array[]){
		for(int i = 0; i < array.length; i++)
			System.out.print(array[i] + "\t");
		System.out.println();
	}
	
	public static void printMatrix(int matrix[][]){
		for(int i = 0; i < matrix.length; i++){
			printArray(matrix[i]);
		}
	}
	
	public static void printMatrix(boolean matrix[][]){
		for(int i = 0; i < matrix.length; i++){
			printArray(matrix[i]);
		}
	}
}

class Coordinates{
	public int value;
	public Coordinates next;
	Coordinates(int input_value){
		value = input_value;
		next = null;
	}
	
	public void add(Coordinates c){
		if(next != null){
			next.add(c);
		}else{
			next = c;
		}
	}
}

Measured memory_bytes: 17728
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main(){
    int H, W, K;
    cin >> H >> W >> K;
    const int MOD = 1e9 + 7;
    vector<vector<long long>> dp(H + 1, vector<long long> (W));
    if(W == 1 && K == 1){
        cout << 1 << endl;
        return 0;
    }
    dp[0][0] = 1;
    for(int i = 0; i < H; i++){
        for(int bit = 0; bit < (1 << (W - 1)); bit++){
            int flag = 0;
            for(int j = 0; j < W - 1; j++){
                if(bit & (1 << j)){
                    if(flag == 1) {
                        flag = 2;
                        break;
                    }
                    flag = 1;
                }
                else flag = 0;
            }
            if(flag == 2) continue;
            for(int j = 0; j < W - 1; j++){
                if(bit & (1 << j)) {
                    dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j]) % MOD;
                    dp[i + 1][j] = (dp[i + 1][j] + dp[i][j + 1]) % MOD;
                }
                else{
                    if(j == 0) dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % MOD;
                    else if(!(bit & (1 << (j - 1)))) dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % MOD;
                    if(j == W - 2) dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j + 1]) % MOD;
                }
            }
        }
    }
    cout << dp[H][K - 1] << endl;
}

Measured memory_bytes: 3600
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;

#define loop(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define dump(a) cerr << #a << " = " << (a) << "(L:" << __LINE__ << ")" << endl

const double PI = acos(-1.0);

void solve(long long N) {
    N--;
    string s;
    do {
        s += 'a' + char(N % 26);
        N /= 26;
        N--;
    } while (0 <= N);
    reverse(s.begin(), s.end());
    cout << s << endl;
}

int main() {
    long long N;
    scanf("%lld", &N);
    solve(N);
    return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using longlong=long long;

int main(){
    std::cin.tie(nullptr);std::cin.sync_with_stdio(false);
    int n;std::cin>>n;
    std::vector<int>a(n);
    int ave=0;
    for(int i=0;i<n;i++){
        int x;std::cin>>x;
        ave+=x;
        a.at(i)=x;
    }
    ave=(int)std::round((double)ave/n);
    int ans=0;
    for(int i=0;i<n;i++){
        ans+=(a.at(i)-ave)*(a.at(i)-ave);
    }
    std::cout<<ans<<std::endl;
}

Measured memory_bytes: 512
<?php
//error_reporting(0);
$N = trim(fgets(STDIN));
//list($N,$M) =  explode(" ",trim(fgets(STDIN)));
$A =  explode(" ",trim(fgets(STDIN)));

$ans = 0;
foreach($A as $a) {
  $ans += 1.0 /$a;
}

printf("%f\n",1/$ans);


Measured memory_bytes: 4728
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()


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


int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n) cin>>a[i];
    vector<int> r(n), l(n);
    int s=a[0], t=a[n-1];
    l[0]=0;
    l[1]=s;
    r[n-1]=0;
    r[n-2]=t;
    rep(i,n-2){
        s=gcd(s,a[i+1]);
        t=gcd(t,a[n-2-i]);
        l[i+2]=s;
        r[n-3-i]=t;
    }
    int ans=0;
    rep(i,n){
        int x=gcd(l[i],r[i]);
        ans=max(ans,x);
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

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

    int a, b, c;
    cin >> a >> b >> c;
    if (a == b && a != c) {
        cout << "Yes";
    }
    else if (a == c && b != c) {
        cout << "Yes";
    }
    else if (b == c && a != b) {
        cout << "Yes";
    }
    else  {
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 256