akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int> t(3);
  for(int i=0;i<3;i++){
    cin>>t[i];
  }
  sort(t.begin(),t.end());
  if((t[0]==5)&&(t[1]==5)&&(t[2]==7))cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}
      


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

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

ll A, B, C, D;
vector<vector<vector<ll>>> Dp;
const ll MOD = 998244353;

int main() {
	cin >> A >> B >> C >> D;
	vector<vector<long long>> DP(C + 1, vector<long long >(D + 1));
	DP[A][B] = 1;
	for (int n = A; n <= C; ++n) {
		for (int m = B; m <= D; ++m) {
			if (n == A && m == B) {
				continue;
			}
			DP[n][m] = (m *DP[n - 1][m]  + n * DP[n][m - 1]  - (n - 1) *(m - 1) *DP[n - 1][m - 1] % MOD+ MOD) % MOD;
			//負のあまりは調整が必要！
		}
	}
	cout << DP[C][D] << endl;
	return 0;
}

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

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;


//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

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

#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)


struct Edge {
    int to, from;
    ll cost;
    Edge(int from, int to, ll cost): from(from), to(to), cost(cost) {}
};

typedef vector<vector<Edge>> AdjList;
AdjList graph;

typedef vector<ll> vec;
typedef vector<vec> mat;

mat mul(mat &A, mat &B) {
    mat C(A.size(), vec((int)B[0].size()));
    for(int i=0; i<A.size(); ++i){
        for(int k=0; k<B.size(); ++k){
            for(int j=0; j<B[0].size(); ++j){
                C[i][j] = (C[i][j] + A[i][k] * B[k][j] %MOD) % MOD;
            }
        }
    }
    return C;
}
mat mat_pow(mat A, ll n) {
    mat B(A.size(), vec((int)A.size()));

    for(int i=0; i<A.size(); ++i){
        B[i][i] = 1;
    }

    while(n > 0) {
        if(n & 1) B = mul(B, A);
        A = mul(A, A);
        n >>= 1;
    }
    return B;
}


int main() {
    //cin.tie(0);
    //ios::sync_with_stdio(false);
    //cout << fixed << setprecision(10);
    
    int A, B; cin >> A >> B;
    if(A<=8 && B<=8){
        cout << "Yay!" << endl;
    }else{
        cout << ":(" << endl;
    }

    return 0;

}

Measured memory_bytes: 256
a= [list(map(int, input().split())) for i in range(3)]
n=int(input())
b=list(int(input()) for i in range(n))
c=[[0,0,0] for i in range(3)]

for i in range(n):
    for j in range(3):
        for k in range(3):
            if b[i]==a[j][k]:
                c[j][k]=1

if sum(c[0])==3 or sum(c[1])==3 or sum(c[2])==3:
    print('Yes')

elif sum(list(map(lambda x: x[0], c)))==3 or sum(list(map(lambda x: x[1], c)))==3 or sum(list(map(lambda x: x[2], c)))==3:
    print('Yes')

elif (c[0][0]==1 and c[1][1]==1 and c[2][2]==1) or (c[0][2]==1 and c[1][1]==1 and c[2][0]==1):
    print('Yes')

else:
    print('No')

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    int prex = 0, prey = 0, time = 0;
    rep (i, n) {
        int t, x, y;
        cin >> t >> x >> y;
        int dist = abs(prex - x) + abs(prey - y);
        if (dist > (t - time) || dist % 2 != (t - time) % 2) {
            cout << "No" << endl;
            return 0;
        }
        prex = x, prey = y, time = t;
    }
    cout << "Yes" << endl;
    
    return 0;
}



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

using namespace std;

char tbl[100][100];
int main(){
    long a,b;
    cin >> a >> b;

    for(int i=0; i<50; i++){
        for(int j=0; j<100; j++){
            tbl[i][j] = '.';
            tbl[50+i][j] = '#';
        }
    }

    int count=1;
    for(int i=0; i<50; i+=2){
        if(count>=b) break;
        for(int j=0; j<100; j+=2){
            if( count>=b) break;
            tbl[i][j]='#';
            count++;
        }
    }
    count=1;
    for(int i=51; i<100; i+=2){
        if(count>=a) break;
        for(int j=0; j<100; j+=2){
            if( count>=a) break;
            tbl[i][j]='.';
            count++;
        }
    }

    cout << 100 << " " << 100 << endl;
    for(int i=0; i<100; i++){
        for(int j=0; j<100; j++){
            cout << tbl[i][j];
        }
        cout << endl;
    }
    return 0;
}

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

int n;
int m;
int ms[50];
int INF = 1000000000;
int dp[50010];

int pay ( int remained )
{
	if ( remained == 0 )
		return 0;
	if ( remained < 0 )
		return INF;
	if ( dp[remained] != -1 )
		return dp[remained];

	int result = INF;
	for ( int i = 0; i < m; ++i )
	{
		result = std::min( result, pay( remained - ms[ i ] ) + 1 );
	}
	return dp[ remained ] = result;	
}

int main()
{
	memset( dp, -1, sizeof( dp ) );
	std::cin >> n >> m;
	for ( int i = 0; i < m; ++i )
		std::cin >> ms[ i ];

	std::cout << pay( n )  << std::endl;
	return 0;
}

Measured memory_bytes: 3708
#include<iostream>
using namespace std;
static const int N = 10000;

int main() {
	int n;
	int i;
	int A[N];
	int B[N];
	int score_A = 0;
	int score_B = 0;

	while (1) {
		cin >> n;

		if (n == 0) break;

		for (i = 0; i < n; i++) {
			cin >> A[i];
			cin >> B[i];
		}

		for (i = 0; i < n; i++) {
			if (A[i] > B[i]) {
				score_A += A[i] + B[i];
			}
			else if (A[i] < B[i]) {
				score_B += A[i] + B[i];
			}
			else if (A[i] = B[i]) {
				score_A += A[i];
				score_B += B[i];
			}
		}

		cout << score_A << " " << score_B << endl;

		for (i = 0; i < n; i++) {
			score_A = 0;
			score_B = 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3036
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a!=1 && b!=1 && a<b){
		cout<<"Bob"<<endl;
	}
	if(a!=1 && b!=1 && a>b){
		cout<<"Alice"<<endl;
	}
	if(a==b){
		cout<<"Draw"<<endl;
	}
	if(a==1 && b!=a){
		cout<<"Alice"<<endl;
	}
	if(b==1 && b!=a){
		cout<<"Bob"<<endl;
	}	
	
	
}

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

bool DifferentElements(std::vector<int> x){
    std::sort(x.begin(), x.end());
    for(auto i = 0; i < x.size() - 1; i++){
        if(x.at(i) == x.at(i + 1)){
            return false;
        }
    }
    return true;
}

int main(){
    int N;
    std::cin >> N;
    std::vector<int> A(N);
    for(auto i = 0; i < N; i++){
        std::cin >> A.at(i);
    }

    if(DifferentElements(A)){
        std::cout << "YES" << std::endl;
    }else{
        std::cout << "NO" << std::endl;
    }

    return 0;
}


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

int main() {
  int n,s=0,x;
  cin >> n;
  
  for (int i=0;i < n;i++) {
  cin >> x;
    
  int m=x,k=0;
    
    for (int j=0;;j++) {
     if (m%2 == 1)
       break;
      
    m /= 2;
    k++;
    }
    
  if (i == 0)
    s += k;
    
  else if (s > k)
    s = s*0+k;
    
  }
  cout << s << 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 A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        String ans;

        if (A == B && B == C) {
            ans = "Yes";
        } else {
            ans = "No";
        }

        System.out.println(ans);

    }
}

Measured memory_bytes: 23636
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;

ll N;

int main(){
    cin>>N;

    string ans;
    while(N!=0){
        char x='a'+((--N)%26);
        ans+=x;
        N/=26;
    }
    reverse(ans.begin(),ans.end());

    cout<<ans<<endl;
}


Measured memory_bytes: 3636
#include<cctype>
#include<string>
#include<algorithm>
#include<iostream>
#include<set>
#include<regex>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<ctime>
#include<vector>
#include<bitset>
#include<cstdio>
#include<numeric>
#include<utility>
#include<sstream>
#include<cstdlib>
#include<iomanip>
#include<cstring>
#include<map>
#include<functional>
#include<unordered_map>
#define _USE_MATH_DEFINES
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
#define pb(n) push_back(n)
#define ue(N) N.erase(unique(N.begin(),N.end()),N.end());
#define nou(S) cout << S
#define hou(S) cout << setprecision(30) << S << endl
#define vec(K,L,N,S) vector<L> K(N,S)
#define dv(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define tv(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define maxx 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define endl "\n"
typedef long long int lli;
typedef unsigned long long int uli;
const uli mod = 1e9 + 7;
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int a, b;
    cin >> a >> b;
    cout << a * b << endl;
}

Measured memory_bytes: 3652
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.ABC_115
{
    class B
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            var ps = new int[n];
            int res = 0;
            int max = int.MinValue;
            for(int i = 0; i < n; i++)
            {
                ps[i] = ReadInt();
                max = Math.Max(max, ps[i]);
                res += ps[i];
            }
            Console.WriteLine(res - max / 2);
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
const ll INF = (1ll << 60);

int main() {
  ll t1, t2, a1, a2, b1, b2;
  cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;
  if (t1 * a1 + t2 * a2 == t1 * b1 + t2 * b2) {
    cout << "infinity" << endl;
    return 0;
  }

  ll ans = 0;
  if (t1 * a1 + t2 * a2 > t1 * b1 + t2 * b2) {
    if (a1 < b1) {
      ans += 1;
    }
    ll i = (t1 * b1 - t1 * a1) / (t1 * a1 + t2 * a2 - t1 * b1 - t2 * b2);
    ll j = (t1 * b1 - t1 * a1) % (t1 * a1 + t2 * a2 - t1 * b1 - t2 * b2);
    if (i > 0) ans += 2 * i;
    if (i > 0 && j == 0) ans -= 1;
  } else {
    if (a1 > b1) {
      ans += 1;
    }
    ll i = (t1 * a1 - t1 * b1) / (t1 * b1 + t2 * b2 - t1 * a1 - t2 * a2);
    ll j = (t1 * a1 - t1 * b1) % (t1 * b1 + t2 * b2 - t1 * a1 - t2 * a2);
    if (i > 0) ans += 2 * i;
    if (i > 0 && j == 0) ans -= 1;
  }

  cout << ans << endl;
}


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

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

bool betemp(string sl, string sr, int l, int r) {
  if (sl == sr)
    return (r - l) % 2 == 1;
  else
    return (r - l) % 2 == 0;
}

int main() {
  int n;
  while (cin >> n) {
    string vac = "Vacant";
    string sl, sr, str;
    int l = 0, r = n / 2;
    cout << l << endl;
    cin >> sl;
    if (sl == vac) return 0;
    cout << r << endl;
    cin >> sr;
    if (sr == vac) return 0;

    if (!betemp(sl, sr, l, r)) {
      swap(sl, sr), l = r, r = n;
    }
    while (r - l > 1) {
      int m = (l + r) / 2;
      cout << m << endl;
      cin >> str;
      if (str == vac) return 0;
      if (betemp(sl, str, l, m))
        sr = str, r = m;
      else
        sl = str, l = m;
    }
  }
}

Measured memory_bytes: 852
// https://beta.atcoder.jp/contests/abc089

#include <iostream>
using namespace std;

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

    long long A, B;
    int K;

    cin >> A >> B >> K;

    long long show = A;

    for (int i = 1; i <= K && show <= B; ++i)
    {
        cout << show << endl;
        show += 1;
    }

    if (B - K + 1 > show)
    {
        show = B - K + 1;
    }

    int max = B - show + 1;
    for (int i = 1; i <= max && show <= B; ++i)
    {
        cout << show << endl;
        show += 1;
    }

    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

    /*
    ||||||||||||||||||||||||||||||||||||||||||||||||
       |      |||         |      ||||    ||||  |   |
      | |     |   |      | |     |   |  |      |   |
     |   |    |    |    |   |    |   |  |      |   |
    |||||||   |    |   |||||||   |||     |||   |||||
    |     |   |   |    |     |   | |        |  |   |
    |     |   |||      |     |   |  ||  ||||   |   |
    ||||||||||||||||||||||||||||||||||||||||||||||||

    */
    using namespace std;
    //#include "testlib.h"
    #define ff first
    #define ss second
    #define mp make_pair
    #define all(v) v.begin(),v.end()
    #define int long long
    #define ll long long
    #define M 1000000007

    #define mii  map<ll ,ll >
    #define msi  map<string,ll >
    #define mis  map<ll int, string>
    #define rep(a,b)    for(ll i=a;i<b;i++)
    #define rep0(n)    for(ll i=0;i<n;i++)
    #define repi(i,a,b) for(ll i=a;i<b;i++)
    #define pb push_back
    #define vi vector<ll>
    #define mp make_pair
    #define vs vector<string>
    #define ppb pop_back
    #define endl '\n'
    #define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define r0 return 0;
    #define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
    #define FORE(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
    #define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #define input freopen("input.txt", "r", stdin);
    #define Set(a, s) 4(a, s, sizeof (a))
    #define FOR repi
    #define pii pair<int,int>
    //#define float long double
    ll max(ll a, ll b) { return (a > b)? a : b;}
    int min(int a, int b) { return (a < b)? a : b;}


     int solve()
     {
        int x,a;
        cin>>x>>a;
        if(x<a) cout<<"0";
        else cout<<"10";
         
     }
    signed main()
    {   
        asdf
        int t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }     
        
}

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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 9e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class ABulletinBoard {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int n, h, w;
	    in >> n >> h >> w;
	    out << (n-h+1) * (n-w+1) << endl;
	}
};


int main() {
	ABulletinBoard solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

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

const int N = 100500;



int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

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

	//cout << setprecision(10) << fixed;
	
	int a, b;
	cin >> a >> b;

	if (a <= 0 && 0 <= b)
		cout << "Zero";
	else if (a > 0)
		cout << "Positive";
	else
		cout << (((min(-1, b) - a + 1) & 1) ? "Negative" : "Positive");
	
	//cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

	return 0;
}


Measured memory_bytes: 256
// Shift-JIS（シフトジス）

#include <bits/stdc++.h>
using namespace std;

int main()
{
    long long r, D, x;
    cin >> r >> D >> x;
    for (int i = 0; i < 10; i++) {
        x = r * x - D;
        cout << x << endl;
    }
}

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

int main() {
  int N;
  cin >> N;
  vector<bool> flags(8);
  int minCnt = 0, maxCnt = 0;
  
  for(int i = 0; i < N; i++){
    int a;
    cin >> a;
    if(a < 3200){
      int index = a / 400;
      if(flags[index] == false){
        flags[index] = true;
        minCnt++;
      }
    } else {
      maxCnt++;
    }
  }

  int color = 0;
  for(bool tf: flags){
    if(tf)
      color++;
  }

  maxCnt += color;
  if(maxCnt > N)
    maxCnt = N;
  if(minCnt < 1)
    minCnt = 1;

  cout << minCnt << " " << maxCnt << endl;
    
}


Measured memory_bytes: 256
import java.util.*

val sc = Scanner(System.`in`)
var S: String = sc.next()

fun main(args: Array<String>) {
    println(if (judge(S)) "AC" else "WA")
}

fun judge(s: String): Boolean {
    if (s[0] != 'A') {
        return false
    }
    var flg = false
    for (i in 1 until s.length) {
        if (s[i].isUpperCase()) {
            if (s[i] != 'C' || i == 1 || i == s.length - 1 || flg) {
                return false
            }
            flg = true
        }
    }
    if (!flg) {
        return false
    }
    return true
}


Measured memory_bytes: 31268
import sys
import math


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())


w, h, x, y = inintm()

if x == w/2 and y == h/2:
    print("{} {}".format(w*h/2, 1))
else:
    print("{} {}".format(w*h/2, 0))

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

int main() {
  int x,c=0;
  while(true)
    {
      cin >> x;

      if(x==0){
	break;
      
      }
      c=c+1;
	cout << "Case " <<c<< ": "<< x << endl; 
    }

    return 0;
}



Measured memory_bytes: 3080
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int h[] = new int[n];
		for(int i = 0; i < n; i++){
			h[i] = sc.nextInt();
		}
		int cnt = 0;
		int maxcnt = 0;
		for(int i = 0; i < n - 1; i++){
			if(h[i] >= h[i+1]){
				cnt++;
			}
			else{
				if(maxcnt < cnt){
					maxcnt = cnt;
				}
				cnt = 0;
			}
		}
		if(maxcnt < cnt){
			maxcnt = cnt;
		}
		System.out.print(maxcnt);
	}

}

Measured memory_bytes: 50388
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int crackers =  sc.nextInt();
        int people =  sc.nextInt();
        if(crackers % people == 0) System.out.println(0);
        else System.out.println(1);
    }
}

Measured memory_bytes: 23124
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int MAXN = 2010;
inline int read() {
    int n = 0, f = 1; char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-') f = -f;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        n = 10 * n + (c ^ '0');
        c = getchar();
    }
    return f * n;
}
LL val[MAXN];
int main() {
    for (int i = -1000; i <= 1000; i++) {
        LL p = 1LL * i * i * i * i * i;
        val[i + 1000] = p;
    }
    LL n = read();
    for (int i = 0; i <= 2000; i++) {
        for (int j = 0; j <= 2000; j++) {
            if (val[i] - val[j] == n) {
                printf("%d %d\n", i - 1000, j - 1000);
                return 0;
            }
        }
    }
}


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

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

Measured memory_bytes: 3568
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

//Quest of Merchant
public class Main{

	int N, M, W, T, INF = 1<<23;
	
	int[] w, p, x, y;
	int[][] item, adj;
	
	int[][] dist;
	int[] bestTime;
	int[][] sell;
	int[] bestSell;
	
	void run(){
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt(); M = sc.nextInt(); W = sc.nextInt(); T = sc.nextInt();
		Map<String, Integer> ref = new HashMap<String, Integer>();
		w = new int[M];
		p = new int[M];
		for(int i=0;i<M;i++){
			ref.put(sc.next(), i);
			w[i] = sc.nextInt();
			p[i] = sc.nextInt();
		}
		x = new int[N+1];
		y = new int[N+1];
		item = new int[N+1][M];
		for(int i=0;i<N;i++){
			Arrays.fill(item[i], INF);
			int L = sc.nextInt();
			x[i] = sc.nextInt(); y[i] = sc.nextInt();
			while(L--!=0){
				int id = ref.get(sc.next());
				item[i][id] = sc.nextInt();
			}
		}
		adj = new int[N+1][N+1];
		for(int i=0;i<=N;i++)for(int j=i+1;j<=N;j++)adj[i][j] = adj[j][i] = Math.abs(x[i]-x[j])+Math.abs(y[i]-y[j]);
		dist = new int[1<<N][N];
		for(int S=1;S<1<<N;S++)for(int last=0;last<N;last++)if(((S>>last)&1)>0){
			int ns = S-(1<<last);
			if(ns==0)dist[S][last] = adj[last][N];
			else{
				int min = INF;
				for(int j=0;j<N;j++)if(((ns>>j)&1)>0)min = Math.min(min, dist[ns][j]+adj[j][last]);
				dist[S][last] = min;
			}
		}
		bestTime = new int[1<<N];
		for(int S=1;S<1<<N;S++){
			int min = INF;
			for(int i=0;i<N;i++)if(((S>>i)&1)>0)min = Math.min(min, dist[S][i]+adj[i][N]);
			bestTime[S] = min;
		}
		bestSell = new int[1<<N];
		int[] c = new int[M];
		int[] ws = new int[W+1];
		for(int V=1;V<1<<N;V++){
			Arrays.fill(c, INF);
			Arrays.fill(ws, 0);
			for(int i=0;i<N;i++)if(((V>>i)&1)>0)for(int j=0;j<M;j++)c[j]=Math.min(c[j], item[i][j]);
			for(int j=0;j<M;j++)c[j] = Math.max(0, p[j]-c[j]);
			for(int k=1;k<=W;k++)for(int j=0;j<M;j++)if(w[j]<=k)ws[k] = Math.max(ws[k], ws[k-w[j]]+c[j]);
			bestSell[V] = ws[W];
		}
		long[] dp = new long[T+1];
		for(int t=1;t<=T;t++){
			dp[t] = dp[t-1];
			for(int V=1;V<1<<N;V++){
				if(bestTime[V]<=t)dp[t] = Math.max(dp[t], dp[t-bestTime[V]] + bestSell[V]);
			}
		}
		System.out.println(dp[T]);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000000000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    set<string>s;
    ll n;
    cin>>n;
    while(n--)
    {
        string str;
        cin>>str;
        s.insert(str);
    }
    cout<<s.size();
    return 0;
}


Measured memory_bytes: 19132
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <set>

#define f first
#define s second
#define PI pair <int, int>
#define M 400010

using namespace std;

int n, m, k, X[M], Y[M];

PI S[M];

set <PI> hsh;

set <int> OvO[M];

int Mn[M];

int main() {
    scanf("%d%d%d", &n, &m, &k);
    for(int i = 1; i <= k; i++) scanf("%d%d", &X[i], &Y[i]), S[i] = PI(X[i], Y[i]);
    sort(S + 1, S + k + 1);
    S[++k] = PI(n + 1, 1);
    for(int i = 1; i <= k; i++) hsh.insert(S[i]);
    for(int i = 1; i <= n; i++) Mn[i] = n + 1;
    for(int i = 1; i <= k; i++) OvO[S[i].s].insert(S[i].f);
    for(int i = 1; i <= m; i++) OvO[i].insert(n + 1);
    int x = 1, y = 1, ans = *OvO[1].lower_bound(1) - 1;
    for(; ;) {
        x++;
        if(hsh.count(PI(x, y)) || x == n + 1) {
            printf("%d\n", ans);
            return 0;
        }
        if(y < m && !hsh.count(PI(x, y + 1))) {
            y++;
            ans = min(ans, *OvO[y].lower_bound(x) - 1);
        }
    }
    return 0;
}

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

vector<signed int> pat(13);
vector<signed int> ans(13);
int ans_size;

void func(int cnt, int now, int w){
  if(cnt >= 13){
    return;
  }
  if(now == w){
    ans = pat;
    ans_size = cnt;
    return;
  }
  for(int i = -1; i <= 1; i++){
    pat[cnt] = i;
    func(cnt + 1, now + pow(3, cnt) * i, w);
  }
}

int main(void){
  int w;
  cin >> w;
  func(0, 0, w);
  for(int i = ans_size-1; i >= 0; i--){
    if(ans[i] == -1) cout << "-";
    if(ans[i] ==  0) cout << "0";
    if(ans[i] ==  1) cout << "+";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 1248
(defun barasu (n &optional (acc 1))
  (cond ((= n acc)
         acc)
        ((< n acc)
         (1- acc))
        (t 
         (barasu (- n acc) (1+ acc)))))      

(defun main (n)
  (let ((p 2)
        (ans-e 0)
        (ans 0))
    (labels ((next-prime (num)
               (loop :for i :from (1+ num)
                     :if (sb-int:positive-primep i)
                     :return i)))
      ;;
      (loop :named yyy
            :do (cond ((= n 1)
                       (incf ans (barasu ans-e))
                       (return-from yyy))
                      ((= n p)
                       (setf n (/ n p))
                       (incf ans-e))
                      ((> p (sqrt n))
                       (incf ans (barasu ans-e))
                       (incf ans)
                       (return-from yyy))
                      ((= (mod n p) 0)
                       (setf n (/ n p))
                       (incf ans-e))
                      (t
                       (incf ans (barasu ans-e))
                       (setf ans-e 0)
                       (setf p (next-prime p)))))
      ;;
      ans)))

(let ((n (read)))
  (format t "~A~%" (main n)))


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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define PI (acos(-1.0))
#define MODN 1000000007
#define MODN2 998244353
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

int main(){

    int a,b;
    cin >> a >> b;

    if(a > 0 && b > 0){
        cout << "Positive" << endl;
    }else if(a <= 0 && 0 <= b){
        cout << "Zero" << endl;
    }else{
        int count = b - a + 1;

        if(count % 2 == 0){
            cout << "Positive" << endl;
        }else{
            cout << "Negative" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define maxi 10000000
// cout << "YES\n";
// cout << "NO\n";
int main()
{
    ll a, b, c, d, res = LLONG_MIN;
    cin >> a >> b >> c >> d;
    res = max({res, a * c, a * d, b * d, b * c});
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define IOS {ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
#define endl "\n"
#define float long double
#define int long long int
#define f(i, a, b) for(int i=a; i<b; i++)
#define fb(i, a, b) for(int i=a; i>=b; i--)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define LB lower_bound
#define UB upper_bound
#define g(t, n) get<n>(t)
#define fp(x, y) fixed<<setprecision(y)<<x
#define PI 3.141592653589793238462643383279502884
using namespace std;

const int M = (int)2e5+5;
const int mod = (int)1e9+7;

void solve()
{
    int s;
    cin>>s;
    int dp[2001] = {};
    dp[0] = dp[1] = dp[2] = 0;
    f(i, 3, 2001)
    {
    	dp[i] = 1;
    	f(j, 3, i)
    	{
    		dp[i] += dp[i-j];
    		dp[i] %= mod;
    	}
    }
    cout<<dp[s]<<endl;
}

int32_t main()
{
    IOS
    int t = 1;
    // cin>>t;
    f(tno, 1, t+1)
    {
        // cout<<"Case #"<<tno<<": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;
const double pi = acos(-1.0);

int main() {
    ll n, x, t; cin >> n >> x >> t;
    ll a = n / x;
    if(n % x != 0) a += 1;
    cout << a * t << endl;
}


Measured memory_bytes: 3592
import java.io.*;
class Main{
	public static void main(String[] args){
		
		try{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		
		String c = in.readLine();
			
					int num = Integer.parseInt(c);
		
		System.out.println(num*num*num);
		}catch(IOException e){
			e.printStackTrace();
		}

	}
}

Measured memory_bytes: 24304
#include<bits/stdc++.h>
#define int long long
#define P 998244353
using namespace std;
int n,K,a[200001],s[200001],l[11],r[11];
signed main(){
	cin>>n>>K;
	for(int i=1;i<=K;i++)cin>>l[i]>>r[i];
	a[1]=1;s[1]=1;s[2]=P-1;
	for(int i=1;i<=n;i++){
		a[i]=a[i-1]+s[i];a[i]%=P;
		for(int j=1;j<=K;j++){
			if(l[j]+i<=n)s[l[j]+i]=(s[l[j]+i]+a[i])%P;
			if(r[j]+i+1<=n)s[r[j]+i+1]=(s[r[j]+i+1]-a[i]+P)%P;
		}
	}
	printf("%lld\n",a[n]);
	return 0;
}

Measured memory_bytes: 6816
#include <iostream>
 
using namespace std;
 
int main()
{
	long long n , m , ans , b;
	cin >> n >> m;
	if (m > (2 * n))
	{
		m -= (2 * n);
		ans = (n + (m / 4));
	}
	else
		ans = (m / 2);
	cout << ans;
}

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

using namespace std;

typedef long long ll;

const int MOD=1e9+7;

int n,a,b;
ll ans=1;

inline ll qp(int b) {
	ll a=2,ans=1;
	while(b) {
		if(b&1) (ans*=a)%=MOD;
		(a*=a)%=MOD;
		b>>=1;
	}
	return ans;
}

inline void exgcd(const int &a,const int &b,ll &x,ll &y) {
	if(!b) {
		x=1,y=0;
		return ;
	}
	exgcd(b,a%b,y,x);
	y-=(a/b)*x;
	return ; 
}

inline ll comb(const int &n,const int &m) {
	ll x,y,ans=1,tmp=1;
	for(int i=n-m+1; i<=n; ++i) ans=ans*i%MOD;
	for(int i=2; i<=m; ++i) tmp=tmp*i%MOD;
	exgcd(tmp,MOD,x,y);
	if(x<0) x+=MOD;
	return ans*x%MOD;
}

int main() {
	scanf("%d %d %d",&n,&a,&b);
	ans=(qp(n)-1-comb(n,min(a,n-a))-comb(n,min(b,n-b)))%MOD;
	if(ans<0) ans+=MOD;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
module type Comparable = sig
  type t
  val compare : t -> t -> int
end

module Make(Cmp : Comparable) = struct
  type tree = Nil | Node of Cmp.t * tree * tree

  let create () = Nil

  let insert x t =
    let rec doit = function
      | Nil -> Node (x, Nil, Nil)
      | (Node (y, _, _)) as d when x = y -> d
      | Node (y, l, r) when Cmp.compare x y < 0 -> Node (y, doit l, r)
      | Node (y, l, r) -> Node (y, l, doit r)
    in
    doit t

  let preorder f t =
    let rec doit = function
      | Nil -> ()
      | Node (x, l, r) -> (f x; doit l; doit r)
    in
    doit t

  let inorder f t =
    let rec doit = function
      | Nil -> ()
      | Node (x, l, r) -> (doit l; f x; doit r)
    in
    doit t
end

module T = Make(struct type t = int let compare x y = x - y end)

let print t =
  let f e = print_string " "; print_int e in
  T.inorder f t;
  print_newline ();
  T.preorder f t;
  print_newline ()

let split str delim =
  let rec doit s acc =
    match
      try Some (String.rindex s delim) with _ -> None
    with
    | None -> s :: acc
    | Some i ->
        let s1 = String.sub s 0 i in
        let s2 = String.sub s (i + 1) (String.length s - String.length s1 - 1) in
        doit s1 (s2 :: acc)
  in
  doit str []

let () =
  let m = read_int () in
  let rec read i t =
    if i < m then begin
      match split (read_line ()) ' ' with
      | ["insert"; n] -> read (i + 1) (T.insert (int_of_string n) t)
      | _ -> (print t; read (i + 1) t)
    end
  in
  read 0 (T.create ())

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

using namespace std;

int main(void){
    int prev,group[200200],n,i,stone,ans,pnt;
    cin >> n;
    while(n!=0){
        fill(group,group+2*n+1,0);
        group[n]=1;
        pnt = n;
        ans = 0;
        cin >> prev;
        if(prev == 0){
            ans++;
        }
        for(i=1; i<n; i++){
            cin >> stone;
            if(prev == stone){
                group[pnt]++;
            }else if(i%2==0){
                pnt++;
                group[pnt]=1;
            }else{
                if(stone==0){
                    ans += group[pnt];
                }else{
                    ans -= group[pnt];
                }
                pnt--;
                group[pnt] += group[pnt+1];
                group[pnt] ++;
            }
            prev = stone;
            if(stone == 0){
                ans++;
            }
        }
        cout << ans << endl;
        cin >> n;
    }
    return 0;
}

Measured memory_bytes: 1940
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
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; }



int main() {  
    int n; cin >> n;
    cout << n / 3 << ln;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
 
	int n, max_w;
	cin >> n >> max_w;
 
	ll w[n], v[n];
	rep(i, n) cin >> w[i] >> v[i];
 
	ll INF = 1e13;
	ll max_v = 100000;
	ll dp[max_v+1];
	// dp[i] : 価値iを作れるときの重さの最小値
	for(int i = 0; i <= max_v; i++){
		dp[i] = INF;
	}
 
	dp[0] = 0;
	for(int i = 1; i <= n; i++){
		for(int j = max_v; j >= 0; j--){
			if(j - v[i-1] >= 0) dp[j] = min(dp[j], dp[j - v[i-1]] + w[i-1]);
		}
	}
 
	ll ans = 0;
	for(int i = 0; i <= max_v; i++){
		if(dp[i] <= max_w) ans = max(ans, (ll)i);
	}
 
	cout << ans << endl;
}

Measured memory_bytes: 1024
N, M = map(int, input().split())
py_list = [[int(py) for py in input().split()] for i in range(M)]
order_city = [[] for _ in range(N)]
for i, py in enumerate(py_list):
    order_city[py[0]-1].append((i, py[1]))

ans_list = [None]*M

for p, cities in enumerate(order_city):
    for i, city in enumerate(sorted(cities, key=lambda x: x[1])):
        ans_list[city[0]] = "{0:06d}{1:06d}".format(p+1, i+1)
        
for ans in ans_list:
    print(ans)

Measured memory_bytes: 50892
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  N=I()
  s=S()

  l=[0]*10
  for x in s:
    i=int(x)
    l[i]+=1
  check0=[0]*10

  ans=0
  for i,x in enumerate(s):
    _x=int(x)
    l[_x]-=1

    if check0[_x]!=0:
      continue

    check0[_x]=1

    check=[0]*10
    l2=copy.deepcopy(l)
    for y in s[i+1:]:
      _y=int(y)
      l2[_y]-=1
      if check[_y]!=0:
        continue

      check[_y]=1

      for x in l2:
        if x!=0:
          ans+=1

  return ans

# main()
print(main())


Measured memory_bytes: 6832
import java.util.Scanner;

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

        int n = sc.nextInt();
        long[] A = new long[n];
        for(int i = 0; i<n; i++){
            A[i] = sc.nextLong();
        }

        long[] ruisekiwa = new long[n+1];
        ruisekiwa[0] = 0;

        for(int i = 0; i<n; i++){
            ruisekiwa[i+1] = ruisekiwa[i] + A[i];
        }

        long ans = 0L;
        for(int i = 0; i<n-1; i++){
            ans += A[i] * ((ruisekiwa[n] - ruisekiwa[i+1]) % (1000000000 + 7));
            ans %= 1000000000 + 7;
        }

        System.out.println(ans  % (1000000000 + 7));
    }
}

Measured memory_bytes: 63320
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	int n;
	cin>>n;
	vector<string> g(n);
	for(auto &s:g)
		cin>>s;
	int res=-1;
	for(int u=0;u<n;++u){
		queue<int> q;
		q.push(u);
		vector<int> cost(n,-1);
		vector<int> clr(n,-1);
		clr[u]=0;
		cost[u]=0;
		while(!q.empty()){
			int x=q.front();
			q.pop();
			for(int v=0;v<n;++v)
				if(g[x][v]=='1' && clr[v]==-1){
					clr[v]=!clr[x];
					q.push(v);
					cost[v]=cost[x]+1;
				}
		}
		int cur=*max_element(cost.begin(),cost.end());
		if(u==0)
			for(int i=0;i<n;++i)
				for(int j=0;j<n;++j)
					if(g[i][j]=='1' && clr[i]==clr[j]){
						cout<<-1<<endl;
						return 0;
					}
		res=max(res,cur+1);
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

const string YES = "Yes";
const string NO = "No";

void solve(std::string S, std::string T){
  int n = S.length();
  rep(i,n) {
    if(S[i]!=T[i]) {
      std::cout << NO << std::endl;
      return;
    }
  }
  std::cout << YES << std::endl;
}

int main(){
  std::string S;
  std::cin >> S;
  std::string T;
  std::cin >> T;
  solve(S, T);
  return 0;
}



Measured memory_bytes: 3124
#include <stdio.h>

typedef struct {
	int key, id;
} data;

typedef struct {
	data obj[300001];
	int size;
} max_heap;

void push(data x, max_heap* h)
{
	int i = ++(h->size);
	data tmp;
	h->obj[i] = x;
	while (i > 1) {
		if (h->obj[i].key > h->obj[i>>1].key) {
			tmp = h->obj[i>>1];
			h->obj[i>>1] = h->obj[i];
			h->obj[i] = tmp;
			i >>= 1;
		} else break;
	}
}

data pop(max_heap* h)
{
	int i = 1, j = 2;
	data output = h->obj[1], tmp;
	h->obj[1] = h->obj[(h->size)--];
	while (j <= h->size) {
		if (j < h->size && h->obj[j^1].key > h->obj[j].key) j ^= 1;
		if (h->obj[j].key > h->obj[i].key) {
			tmp = h->obj[j];
			h->obj[j] = h->obj[i];
			h->obj[i] = tmp;
			i = j;
			j = i << 1;
		} else break;
	}
	return output;
}

void add_BIT(int N, int BIT[], int i, int k)
{
	while (i <= N) {
		BIT[i] += k;
		i += (i & -i);
	}
}

int sum_BIT(int BIT[], int r)
{
	int sum = 0;
	while (r > 0) {
		sum += BIT[r];
		r -= (r & -r);
	}
	return sum;
}

int main()
{
	int i, N, M, l[300001], r[300001];
	data d;
	max_heap h;
	h.size = 0;
	scanf("%d %d", &N, &M);
	for (i = 1; i <= N; i++) {
		scanf("%d %d", &(l[i]), &(r[i]));
		d.key = r[i] - l[i] + 1;
		d.id = i;
		push(d, &h);
	}

	int BIT[2][100001] = {};
	for (i = 1; i <= N; i++) {
		add_BIT(M, BIT[0], r[i], 1);
		add_BIT(M, BIT[1], M - l[i] + 1, 1);
	}
	
	int j, ans[100001] = {};
	for (i = M, ans[1] = N; i >= 2; i--) {
		while (h.size > 0 && h.obj[1].key >= i) {
			d = pop(&h);
			add_BIT(M, BIT[0], r[d.id], -1);
			add_BIT(M, BIT[1], M - l[d.id] + 1, -1);
		}
		for (j = i, ans[i] = N - h.size; j <= M; j += i) ans[i] += h.size - sum_BIT(BIT[0], j - 1) - sum_BIT(BIT[1], M - j);
	}
	for (i = 1; i <= M; i++) printf("%d\n", ans[i]);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 7560
#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;

int n, d, x[20][20];
int rt(int x) {
	for (int i = 200; true; i--)
		if (i * i <= x)
			return i;
}
int val(int x[], int z[]) {
	int distance = 0;
	for (int i = 0; i < d; i++)
		distance += (x[i] - z[i]) * (x[i] - z[i]);
	return distance == rt(distance) * rt(distance);
}
int main() {
	scanf("%d %d", &n, &d);
	for (int k = 0; k < n; k++)
		for (int i = 0; i < d; i++)
			scanf("%d", x[k] + i);

	int count = 0;
	for (int i = 0; i + 1 < n; i++)
		for (int j = i + 1; j < n; j++)
			count += val(x[i], x[j]);
	printf("%d\n", count);
}

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

int main(){
    int k,a,b;
    cin>>k;
    cin>>a>>b;
    for(int i=a;i<=b;i++){
        if(i%k==0){
            cout<<"OK"<<endl;
            return 0;
        }
    }
    cout<<"NG"<<endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define int long long
using namespace std;


const int INF=99999999999999;
struct SegmentTree{
	private:
		int N;
		vector<int> node;
	
	public:
		SegmentTree(vector<int> v){
			int sz=v.size();
			N=1; while(N<sz)N*=2;
			node.assign(2*N-1,INF);

			for(int i=0;i<sz;i++)node[i+N-1]=v[i];
			for(int i=N-2;i>=0;i--){
				node[i]=min(node[2*i+1],node[2*i+2]);
			}
		}

		void update(int i,int v){
			//update(x,v):添字xの要素をvに変更する
			i+=N-1;
			node[i]=v;
			while(i>0){
				i=(i-1)/2;
				node[i]=min(node[2*i+1],node[2*i+2]);
			}
		}

		int getmin(int a,int b,int k=0,int l=0,int r=-1){
			if(r<0)r=N;
			if(r<=a || b<=l)return INF;
			if(a<=l && r<=b)return node[k];
			int vl=getmin(a,b,2*k+1,l,(l+r)/2);
			int vr=getmin(a,b,2*k+2,(l+r)/2,r);
			return min(vl,vr);
		}
};

signed main(){
	int N,Q,init; cin>>N>>Q;
	init =pow(2,31)-1;
	vector<int> A(N,init);
	SegmentTree seg(A);
	for(int i=0;i<Q;i++){
		int com; cin>>com;
		if(com==0){
			int i,x; cin>>i>>x;
			A[i]=x;
			seg.update(i,x);
		}
		else if(com==1){
			int s,t; cin>>s>>t;
			int ans=seg.getmin(s,t+1);
			cout<<ans<<endl;
		}
	}
	return 0;
}



Measured memory_bytes: 6572
#include <bits/stdc++.h>
#define EPS 1e-9
#define PI acos(-1)
using namespace std;
typedef long long ll;
const int maxn = 1e5+100;
int fa[maxn];

struct point
{
    int x,y,id;
}p[maxn];

struct costt
{
    int p1,p2,cost;
}l[maxn*4];

int fin(int a)
{
    if(fa[a]==a) return a;
    else return fa[a]=fin(fa[a]);
}

bool cmp1(const point &a,const point &b)
{
    return a.x<b.x;
}

bool cmp2(const point &a,const point &b)
{
    return a.y<b.y;
}

bool cmp3(const costt &a,const costt &b)
{
    return a.cost<b.cost;
}

int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    for(int i = 1; i <= n; i++)
    {
        cin>>p[i].x>>p[i].y;
        p[i].id = i;
        fa[i] = i;
    }
    sort(p+1,p+1+n,cmp1);
    int tot = 0;
    for(int i = 1; i < n; i++)
    {
        l[tot].p1 = p[i].id;
        l[tot].p2 = p[i+1].id;
        l[tot].cost = abs(p[i].x-p[i+1].x);
        tot++;
    }
    sort(p+1,p+1+n,cmp2);
    for(int i = 1; i < n; i++)
    {
        l[tot].p1 = p[i].id;
        l[tot].p2 = p[i+1].id;
        l[tot].cost = abs(p[i].y-p[i+1].y);
        tot++;
    }
    sort(l,l+tot,cmp3);
    ll ans = 0;
    for(int i = 0; i < tot; i++)
    {
        int fa_p1 = fin(l[i].p1);
        int fa_p2 = fin(l[i].p2);
        if(fa_p1==fa_p2) continue;
        else
        {
            fa[fa_p1] = fa_p2;
            ans += l[i].cost;
        }
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 6528
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
const int mod=998244353;
ll n,x,m,ans,tp;
int d[100001],a[100001];
int main(){
	cin>>n>>x>>m;
	d[x]=1,ans=x,a[1]=x;
	for(int i=2;i<=n;i++){
		x=x*x%m;
		if(d[x]){
			ans=0;
			for(int j=1;j<d[x];j++) tp+=a[j];
			for(int j=d[x];j<i;j++) ans+=a[j];
			n-=d[x]-1;
			ans*=(n/(i-d[x]));
			for(int j=1;j<=n%(i-d[x]);j++) ans+=a[d[x]-1+j];
			cout<<ans+tp;
			return 0;
		}
		else d[x]=i,ans+=x,a[i]=x;
	}
	cout<<ans;
}

Measured memory_bytes: 4168